Java Doc for Transaction.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » store » raw » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.iapi.store.raw 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derby.iapi.store.raw.Transaction

All known Subclasses:   org.apache.derby.iapi.store.raw.xact.RawTransaction,
Transaction
public interface Transaction (Code)


Field Summary
final public  intKEEP_LOCKS
    
final public  intRELEASE_LOCKS
    
final public static  intXA_OK
    
final public static  intXA_RDONLY
    


Method Summary
public  voidabort()
     Abort all changes made by this transaction since the last commit, abort or the point the transaction was started, whichever is the most recent.
public  longaddAndLoadStreamContainer(long segmentId, Properties tableProperties, RowSource rowSource)
     Add a new stream container to the segment and load the stream container. This stream container doesn't not have locks, and do not log. It does not have the concept of a page. It is used by the external sort only.

Synchronisation

This call will mark the container as dropped and then obtain an CX lock on the container.

public  longaddContainer(long segmentId, long containerId, int mode, Properties tableProperties, int temporaryFlag)
     Add a new container to the segment.
public  voidaddPostCommitWork(Serviceable work)
     Add to the list of post commit work that may be processed after this transaction commits.
public  voidaddPostTerminationWork(Serviceable work)
     Add to the list of post termination work that may be processed after this transaction commits or aborts.
public  booleananyoneBlocked()
     Return true if any transaction is blocked, even if not by this one.
public  voidclose()
     Close this transaction, the transaction must be idle.
public  LogInstantcommit()
     Commit this transaction.
public  LogInstantcommitNoSync(int commitflag)
     "Commit" this transaction without sync'ing the log. Everything else is identical to commit(), use this at your own risk.
bits in the commitflag can turn on to fine tuned the "commit": KEEP_LOCKS - no locks will be released by the commit and no post commit processing will be initiated.
 voidcreateXATransactionFromLocalTransaction(int format_id, byte[] global_id, byte[] branch_id)
     Convert a local transaction to a global transaction.

Get a transaction controller with which to manipulate data within the access manager.

public  voiddestroy()
     If this transaction is not idle, abort it.
public  voiddropContainer(ContainerKey containerId)
     Drop a container.

Synchronisation

This call will mark the container as dropped and then obtain an CX lock on the container.

abstract public  voiddropStreamContainer(long segmentId, long containerId)
     Drop a stream container.
public  StringgetActiveStateTxIdString()
     get string ID of the actual transaction ID that will be used when transaction is in active state.
abstract public  long[]getCacheStats(String cacheName)
    
 ObjectgetCompatibilitySpace()
     Get the compatibility space of the transaction.

Returns an object that can be used with the lock manager to provide the compatibility space of a transaction.

public  ContextManagergetContextManager()
     Return the context manager this transaction is associated with.
public  LockingPolicygetDefaultLockingPolicy()
     Get the current default locking policy for all operations within this transaction.
public  FileResourcegetFileHandler()
     Get an object to handle non-transactional files.
public  GlobalTransactionIdgetGlobalId()
     Return my transaction identifier.
public  booleanisIdle()
     Reveals whether the transaction has ever read or written data.
public  booleanisPristine()
     Reveal whether the transaction is in a pristine state, which means it hasn't done any updates since the last commit.
public  voidlogAndDo(Loggable operation)
     Log an operation and then action it in the context of this transaction. The Loggable Operation is logged in the transaction log file and then its doMe method is called to perform the required change.
public  LockingPolicynewLockingPolicy(int mode, int isolation, boolean stricterOk)
     Obtain a locking policy for use in openContainer().
public  ContainerHandleopenContainer(ContainerKey containerId, int mode)
     Open a container, with the transaction's default locking policy.
public  ContainerHandleopenContainer(ContainerKey containerId, LockingPolicy locking, int mode)
     Open a container, with the defined locking policy, otherwise as openContainer(int containerId, boolean forUpdate).

Calls locking.lockContainer(this, returnValue, forUpdate) to lock the container.

public  StreamContainerHandleopenStreamContainer(long segmentId, long containerId, boolean hold)
     Open a stream container.
public  intreleaseSavePoint(String name, Object kindOfSavepoint)
     Release the save point of the given name.
abstract public  voidresetCacheStats(String cacheName)
    
public  introllbackToSavePoint(String name, Object kindOfSavepoint)
     Rollback all changes made since the named savepoint was set.
public  voidsetDefaultLockingPolicy(LockingPolicy policy)
     Set the default locking policy for all operations within this transaction.
public  intsetSavePoint(String name, Object kindOfSavepoint)
     Set a save point in the current transaction.
public  voidsetup(PersistentSet set)
     Called after the transaction has been attached to an Access Manger TransactionController.
public  voidxa_commit(boolean onePhase)
     This method is called to commit the current XA global transaction.
public  intxa_prepare()
     This method is called to ask the resource manager to prepare for a transaction commit of the transaction specified in xid.

A value indicating the resource manager's vote on thethe outcome of the transaction.

public  voidxa_rollback()
     rollback the current global transaction.

Field Detail
KEEP_LOCKS
final public int KEEP_LOCKS(Code)



RELEASE_LOCKS
final public int RELEASE_LOCKS(Code)



XA_OK
final public static int XA_OK(Code)



XA_RDONLY
final public static int XA_RDONLY(Code)





Method Detail
abort
public void abort() throws StandardException(Code)
Abort all changes made by this transaction since the last commit, abort or the point the transaction was started, whichever is the most recent. All savepoints within this transaction are released.
exception:
  StandardException - Only exceptions with severities greater than ExceptionSeverity.TRANSACTION_SEVERITY will be thrown.



addAndLoadStreamContainer
public long addAndLoadStreamContainer(long segmentId, Properties tableProperties, RowSource rowSource) throws StandardException(Code)
Add a new stream container to the segment and load the stream container. This stream container doesn't not have locks, and do not log. It does not have the concept of a page. It is used by the external sort only.

Synchronisation

This call will mark the container as dropped and then obtain an CX lock on the container. Once a container has been marked as dropped it cannot be retrieved by any openContainer() call.

Once the exclusive lock has been obtained the container is removed and all its pages deallocated. The container will be fully removed at the commit time of the transaction.
exception:
  StandardException - Standard Cloudscape error policy




addContainer
public long addContainer(long segmentId, long containerId, int mode, Properties tableProperties, int temporaryFlag) throws StandardException(Code)
Add a new container to the segment. The new container initially has one page, page Container.FIRST_PAGE_NUMBER.
If pageSize is equal to ContainerHandle.DEFAULT_PAGESIZE or invalid then a default page size will be picked.
SpareSpace indicates that percent (0% - 100%) of page space that will be attempted to be reserved for updates. E.g. with a value of 20 a page that would normally hold 40 rows will be limited to 32 rows, actual calculation for the threshold where no more inserts are all accepted is up to the implementation. Whatever the value of spaceSpace an empty page will always accept at least one insert. If spare space is equal to ContainerHandle.DEFAULT_PAGESIZE or invalid then a default value will be used.

Synchronisation

The new container is exclusivly locked by this transaction until it commits.
Parameters:
  segmentId - segment to create the container in.
Parameters:
  containerId - If not equal to 0 then this container id will be used to create the container, else if set to 0 thenthe raw store will assign a number.
Parameters:
  mode - mode description in @see ContainerHandle. This mode isonly effective for the duration of the addContainer call and not storedpersistently for the lifetime of the container.
Parameters:
  tableProperties - Implementation-specific properties of theconglomerate. a container identifer that can be used in openContainer()This id is only valid within this RawStoreFactory. Returns a negative number if a container could not be allocated.
exception:
  StandardException - Standard Cloudscape error policy




addPostCommitWork
public void addPostCommitWork(Serviceable work)(Code)
Add to the list of post commit work that may be processed after this transaction commits. If this transaction aborts, then the post commit work list will be thrown away. No post commit work will be taken out on a rollback to save point.
Parameters:
  work - the post commit work that is added



addPostTerminationWork
public void addPostTerminationWork(Serviceable work)(Code)
Add to the list of post termination work that may be processed after this transaction commits or aborts.
Parameters:
  work - the post termination work that is added



anyoneBlocked
public boolean anyoneBlocked()(Code)
Return true if any transaction is blocked, even if not by this one.



close
public void close() throws StandardException(Code)
Close this transaction, the transaction must be idle. This close will pop the transaction context off the stack that was pushed when the transaction was started.
See Also:   RawStoreFactory.startTransaction
exception:
  StandardException - Standard Cloudscape error policy
exception:
  StandardException - A transaction level exception is thrown if the transaction is not idle.



commit
public LogInstant commit() throws StandardException(Code)
Commit this transaction. All savepoints within this transaction are released. the commit instant of this transaction, or null if itdidn't make any changes
exception:
  StandardException - A transaction level exception is thrownif the transaction was aborted due to some error. Any exceptions that occur of lower severity than Transaction severity are caught, the transaction is then aborted and then an exception of Transactionseverity is thrown nesting the original exception.
exception:
  StandardException - Any exception more severe than aTransaction exception is not caught and the transaction is not aborted.The transaction will be aborted by the standard context mechanism.



commitNoSync
public LogInstant commitNoSync(int commitflag) throws StandardException(Code)
"Commit" this transaction without sync'ing the log. Everything else is identical to commit(), use this at your own risk.
bits in the commitflag can turn on to fine tuned the "commit": KEEP_LOCKS - no locks will be released by the commit and no post commit processing will be initiated. If, for some reasons, the locks cannot be kept even if this flag is set, then the commit will sync the log, i.e., it will revert to the normal commit.
exception:
  StandardException - A transaction level exception is thrownif the transaction was aborted due to some error. Any exceptions that occur of lower severity than Transaction severity are caught, the transaction is then aborted and then an exception of Transactionseverity is thrown nesting the original exception.
exception:
  StandardException - Any exception more severe than aTransaction exception is not caught and the transaction is not aborted.The transaction will be aborted by the standard context mechanism.



createXATransactionFromLocalTransaction
void createXATransactionFromLocalTransaction(int format_id, byte[] global_id, byte[] branch_id) throws StandardException(Code)
Convert a local transaction to a global transaction.

Get a transaction controller with which to manipulate data within the access manager. Tbis controller allows one to manipulate a global XA conforming transaction.

Must only be called a previous local transaction was created and exists in the context. Can only be called if the current transaction is in the idle state.

The (format_id, global_id, branch_id) triplet is meant to come exactly from a javax.transaction.xa.Xid. We don't use Xid so that the system can be delivered on a non-1.2 vm system and not require the javax classes in the path.
Parameters:
  format_id - the format id part of the Xid - ie. Xid.getFormatId().
Parameters:
  global_id - the global transaction identifier part of XID - ie.Xid.getGlobalTransactionId().
Parameters:
  branch_id - The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()
exception:
  StandardException - Standard exception policy.




destroy
public void destroy() throws StandardException(Code)
If this transaction is not idle, abort it. After this call close().
See Also:   RawStoreFactory.startTransaction
exception:
  StandardException - Standard Cloudscape error policy
exception:
  StandardException - A transaction level exception is thrown if the transaction is not idle.



dropContainer
public void dropContainer(ContainerKey containerId) throws StandardException(Code)
Drop a container.

Synchronisation

This call will mark the container as dropped and then obtain an CX lock on the container. Once a container has been marked as dropped it cannot be retrieved by any openContainer() call.

Once the exclusive lock has been obtained the container is removed and all its pages deallocated. The container will be fully removed at the commit time of the transaction.
exception:
  StandardException - Standard Cloudscape error policy




dropStreamContainer
abstract public void dropStreamContainer(long segmentId, long containerId) throws StandardException(Code)
Drop a stream container.

Synchronisation

This call will remove the container.
exception:
  StandardException - Standard Cloudscape error policy




getActiveStateTxIdString
public String getActiveStateTxIdString()(Code)
get string ID of the actual transaction ID that will be used when transaction is in active state.



getCacheStats
abstract public long[] getCacheStats(String cacheName)(Code)
Get cache statistics for the specified cache



getCompatibilitySpace
Object getCompatibilitySpace()(Code)
Get the compatibility space of the transaction.

Returns an object that can be used with the lock manager to provide the compatibility space of a transaction. 2 transactions with the same compatibility space will not conflict in locks. The usual case is that each transaction has it's own unique compatibility space.

The compatibility space of the transaction.




getContextManager
public ContextManager getContextManager()(Code)
Return the context manager this transaction is associated with.



getDefaultLockingPolicy
public LockingPolicy getDefaultLockingPolicy()(Code)
Get the current default locking policy for all operations within this transaction. The transaction is initially started with a default locking policy equivalent to
 newLockingPolicy(
 LockingPolicy.MODE_RECORD, LockingPolicy.ISOLATION_SERIALIZABLE, true);
 
This default can be changed by subsequent calls to setDefaultLockingPolicy(LockingPolicy policy). The current default locking policy in this transaction.



getFileHandler
public FileResource getFileHandler()(Code)
Get an object to handle non-transactional files.



getGlobalId
public GlobalTransactionId getGlobalId()(Code)
Return my transaction identifier. Transaction identifiers may be re-used for transactions that do not modify the raw store. May return null if this transaction has no globalId.



isIdle
public boolean isIdle()(Code)
Reveals whether the transaction has ever read or written data. true If the transaction has never read or written data.



isPristine
public boolean isPristine()(Code)
Reveal whether the transaction is in a pristine state, which means it hasn't done any updates since the last commit. true if so, false otherwise



logAndDo
public void logAndDo(Loggable operation) throws StandardException(Code)
Log an operation and then action it in the context of this transaction. The Loggable Operation is logged in the transaction log file and then its doMe method is called to perform the required change. If this transaction aborts or a rollback is performed of the current savepoint (if any) then a compensation Operation needs to be generated that will compensate for the change of this Operation.
Parameters:
  operation - the operation that is to be applied
See Also:   Loggable
exception:
  StandardException - Standard cloudscape exception policy



newLockingPolicy
public LockingPolicy newLockingPolicy(int mode, int isolation, boolean stricterOk)(Code)
Obtain a locking policy for use in openContainer(). The mode and isolation must be constants from LockingPolicy. If higherOK is true then the object returned may implement a stricter form of locking than the one requested.
A null LockingPolicy reference is identical to a LockingPolicy obtained by using MODE_NONE which is guaranteed to exist.
Parameters:
  mode - A constant of the form LockingPolicy.MODE_*
Parameters:
  isolation - A constant of the form LockingPolicy.ISOLATION_*
Parameters:
  stricterOk - True if a stricter level of locking is acceptable, false if an exact match is required. A object that can be used in an openContainer call, null if a matching policy cannot be found.



openContainer
public ContainerHandle openContainer(ContainerKey containerId, int mode) throws StandardException(Code)
Open a container, with the transaction's default locking policy.

Note that if NOWAIT has been specified lock will be requested with no wait time, and if lock is not granted a SQLState.LOCK_TIMEOUT exception will be thrown.

The release() method of ContainerHandle will be called when this transaction is aborted or commited, it may be called explicitly to release the ContainerHandle before the end of the transaction. a valid ContainerHandle or null if the container does not exist.
exception:
  StandardException - Standard cloudscape exception policy




openContainer
public ContainerHandle openContainer(ContainerKey containerId, LockingPolicy locking, int mode) throws StandardException(Code)
Open a container, with the defined locking policy, otherwise as openContainer(int containerId, boolean forUpdate).

Calls locking.lockContainer(this, returnValue, forUpdate) to lock the container. Note that if NOWAIT has been specified lock will be requested with no wait time, and if lock is not granted a SQLState.LOCK_TIMEOUT exception will be thrown.
Parameters:
  locking - The lock policy to use, if null then then a no locking policy will be used. a valid ContainerHandle or null if the container does not exist.
exception:
  StandardException - Standard cloudscape exception policy




openStreamContainer
public StreamContainerHandle openStreamContainer(long segmentId, long containerId, boolean hold) throws StandardException(Code)
Open a stream container. a valid StreamContainerHandle or null if the container does not exist.
exception:
  StandardException - Standard cloudscape exception policy



releaseSavePoint
public int releaseSavePoint(String name, Object kindOfSavepoint) throws StandardException(Code)
Release the save point of the given name. Relasing a savepoint removes all knowledge from this transaction of the named savepoint and any savepoints set since the named savepoint was set.
Parameters:
  name - The user provided name of the savepoint, set by the userin the setSavePoint() call.
Parameters:
  kindOfSavepoint - A NULL value means it is an internal savepoint (ie not a user defined savepoint)Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepointA String value for kindOfSavepoint would mean it is SQL savepointA JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint returns total number of savepoints in the stack.
exception:
  StandardException - Standard cloudscape exception policy
exception:
  StandardException - A statement level exception is thrown if a savepoint alreadyexists in the current transaction with the same name.



resetCacheStats
abstract public void resetCacheStats(String cacheName)(Code)
Reset the cache statistics for the specified cache



rollbackToSavePoint
public int rollbackToSavePoint(String name, Object kindOfSavepoint) throws StandardException(Code)
Rollback all changes made since the named savepoint was set. The named savepoint is not released, it remains valid within this transaction, and thus can be named it future rollbackToSavePoint() calls. Any savepoints set since this named savepoint are released (and their changes rolled back).
Parameters:
  name - The user provided name of the savepoint, set by the userin the setSavePoint() call.
Parameters:
  kindOfSavepoint - A NULL value means it is an internal savepoint (ie not a user defined savepoint)Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepointA String value for kindOfSavepoint would mean it is SQL savepointA JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint returns total number of savepoints in the stack.
exception:
  StandardException - Standard cloudscape exception policy
exception:
  StandardException - A statement level exception is thrown if no savepoint exists with the given name.



setDefaultLockingPolicy
public void setDefaultLockingPolicy(LockingPolicy policy)(Code)
Set the default locking policy for all operations within this transaction. The transaction is intially started with a default locking policy equivalent to
 newLockingPolicy(
 LockingPolicy.MODE_RECORD, LockingPolicy.ISOLATION_SERIALIZABLE, true);
 

Parameters:
  policy - The lock policy to use, if null then then a no locking policy will be installed as the default.



setSavePoint
public int setSavePoint(String name, Object kindOfSavepoint) throws StandardException(Code)
Set a save point in the current transaction. A save point defines a point in time in the transaction that changes can be rolled back to. Savepoints can be nested and they behave like a stack. Setting save points "one" and "two" and the rolling back "one" will rollback all the changes made since "one" (including those made since "two") and release savepoint "two".
Parameters:
  name - The user provided name of the savepoint
Parameters:
  kindOfSavepoint - A NULL value means it is an internal savepoint (ie not a user defined savepoint)Non NULL value means it is a user defined savepoint which can be a SQL savepoint or a JDBC savepointA String value for kindOfSavepoint would mean it is SQL savepointA JDBC Savepoint object value for kindOfSavepoint would mean it is JDBC savepoint returns total number of savepoints in the stack.
exception:
  StandardException - Standard cloudscape exception policy
exception:
  StandardException - A statement level exception is thrown if a savepoint already exists in the current transaction with the same name.



setup
public void setup(PersistentSet set) throws StandardException(Code)
Called after the transaction has been attached to an Access Manger TransactionController. Thus may not be called for all transactions. Purpose is to allow a transaction access to database (service) properties. Will not be called for transactions early in the boot process, ie. before the property conglomerate is set up.
exception:
  StandardException - Standard cloudscape exception policy



xa_commit
public void xa_commit(boolean onePhase) throws StandardException(Code)
This method is called to commit the current XA global transaction.

RESOLVE - how do we map to the "right" XAExceptions.


Parameters:
  onePhase - If true, the resource manager should use a one-phasecommit protocol to commit the work done on behalf of current xid.
exception:
  StandardException - Standard exception policy.




xa_prepare
public int xa_prepare() throws StandardException(Code)
This method is called to ask the resource manager to prepare for a transaction commit of the transaction specified in xid.

A value indicating the resource manager's vote on thethe outcome of the transaction. The possible valuesare: XA_RDONLY or XA_OK. If the resource manager wantsto roll back the transaction, it should do so by throwing an appropriate XAException in the preparemethod.
exception:
  StandardException - Standard exception policy.




xa_rollback
public void xa_rollback() throws StandardException(Code)
rollback the current global transaction.

The given transaction is roll'ed back and it's history is not maintained in the transaction table or long term log.


exception:
  StandardException - Standard exception policy.




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.