com.odi
Class Transaction

java.lang.Object
  extended bycom.odi.Transaction
All Implemented Interfaces:
ObjectStoreConstants

public abstract class Transaction
extends Object
implements ObjectStoreConstants

PSE/PSE Pro uses the Transaction class to represent a logical unit of work. A transaction is a consistent and reliable portion of the execution of a program. In your code, you place calls to the PSE/PSE Pro API to mark the beginning and end of transactions. In an application, the initial access to a persistent object must always occur inside a transaction. Modifications to persistent objects must occur in a transaction when you want to save them.

Either all of a transaction's changes to persistent objects are made successfully, or none is made at all. If a failure occurs in the middle of a transaction, none of its database updates is made.

Transaction is an abstract class. When you invoke the Transaction.begin() method, PSE/PSE Pro automatically finds the subclass of Transaction, creates an instance of that subclass, and uses it to represent your transaction. You are not expected to extend the Transaction class, and PSE/PSE Pro will not work if you do.

If an application terminates at any time other than during a Transaction.commit() operation, PSE/PSE Pro returns the database to the state it was in before the transaction started. If an application terminates during a call to Transaction.commit()

A Control-C or a system crash can cause an application to terminate during a call to Transaction.commit().


Field Summary
static int readOnly
          Deprecated. This constant has been changed to ObjectStore.READONLY.
static int update
          Deprecated. This constant has been changed to ObjectStore.UPDATE.
 
Fields inherited from interface com.odi.ObjectStoreConstants
ALL_EXECUTE, ALL_READ, ALL_WRITE, DEFAULT, DISABLE_AUTO_OPEN, GROUP_EXECUTE, GROUP_READ, GROUP_WRITE, INSTALL_SCHEMA_BATCH, INSTALL_SCHEMA_INCREMENTAL, MULTI_DB_MVCC, MVCC, OBJECTSTORE, OTHER_EXECUTE, OTHER_READ, OTHER_WRITE, OWNER_EXECUTE, OWNER_READ, OWNER_WRITE, PSE, PSE_PRO, READONLY, READONLY_NON_BLOCKING, RETAIN_HOLLOW, RETAIN_READONLY, RETAIN_STALE, RETAIN_TRANSIENT, RETAIN_UPDATE, UPDATE, UPDATE_NON_BLOCKING, WAIT_FOREVER, XA_TRANSACTION
 
Method Summary
abstract  void abort()
          Aborts a transaction.
abstract  void abort(int retain)
          Aborts a transaction and retains objects that were referenced in the transaction.
static Transaction begin(int type)
          Starts a transaction.
abstract  void checkpoint()
          Checkpoints a transaction.
abstract  void checkpoint(int retain)
          Checkpoints a transaction.
abstract  void commit()
          Commits a transaction.
abstract  void commit(int retain)
          Commits a transaction and specifies what should happen to persistent objects after the transaction is over.
static Transaction current()
          Obtains the instance of Transaction that is associated with the current thread.
static int getPriority()
          Gets the priority specified for transactions started by the current session.
abstract  Session getSession()
          Returns the session associated with this Transaction.
abstract  int getType()
          Obtains the type of a transaction.
static boolean hasLockContention()
          Indicates whether or not a Server involved in the current transaction has experienced contention for some persistent objects that the application is using.
static boolean inTransaction()
          Determines whether or not there is a transaction in progress in the session to which the current thread belongs.
abstract  boolean isAborted()
          Returns true if the transaction has been aborted, otherwise false.
abstract  boolean isActive()
          Returns true if the transaction has not been aborted or committed, otherwise false.
static void setDefaultAbortRetain(int retain)
          Sets the default retain operation for the current session for calls to Transaction.abort() that have no argument.
static void setDefaultCommitRetain(int retain)
          Sets the default retain operation for the current session for calls to Transaction.checkpoint() and Transaction.commit() that have no argument.
static void setDefaultRetain(int retain)
          Sets the default retain operation for the current session for calls to Transaction.abort(), Transaction.commit() and Transaction.checkpoint() that have no argument.
static void setPriority(int priority)
          Sets the priority for transactions started by the current session.
 

Field Detail

readOnly

public static final int readOnly
Deprecated. This constant has been changed to ObjectStore.READONLY.

See Also:
Constant Field Values

update

public static final int update
Deprecated. This constant has been changed to ObjectStore.UPDATE.

See Also:
Constant Field Values
Method Detail

begin

public static Transaction begin(int type)
Starts a transaction. Nested transactions are not allowed.

PSE/PSE Pro grants a lock on a database when it starts a transaction or when it opens a database inside a transaction. Your application can open a database inside or outside a transaction. If you open a database inside a transaction, and if the lock you want is available, PSE/PSE Pro immediately grants the lock. PSE/PSE Pro releases the lock when you end the transaction in which you acquired the lock.

Parameters:
type - The type of transaction to start. This value must be one of the following:

  • ObjectStore.READONLY allows the application to read but not modify data in the open database in the current transaction. PSE/PSE Pro immediately obtains a shared read lock on the open database if a read lock is available. If the open database is locked by another session in the same Java VM for read access and there are no sessions waiting for an update lock, PSE/PSE Pro grants a read lock. If the database is locked or being waited for by another session for update, PSE/PSE Pro waits indefinitely until the database is no longer locked for write, and grants the read lock when the database becomes available.

  • ObjectStore.UPDATE allows the application to modify data in the open database in the current transaction. PSE/PSE Pro immediately obtains a write lock for the open database if an exclusive write lock is available. If the database is locked by another session in the same Java VM, for either read or write, PSE/PSE Pro waits indefinitely until the database is no longer locked by any locker, and grants the write lock when the database is available. If there is no open database when you start the current transaction, PSE/PSE Pro tries to obtain a write lock as soon as the session tries to open a database.

  • ObjectStore.READONLY_NON_BLOCKING allows the application to read but not modify data in the open database in the current transaction. PSE/PSE Pro immediately obtains a read lock on the open database if a read lock is available. If the database is locked by another session for read access and there are no sessions waiting for a write lock, PSE/PSE Pro grants a read lock. If the database is locked for write or being waited for by another session for update, PSE/PSE Pro throws com.odi.DatabaseLockedException and the transaction begin operation fails.

  • ObjectStore.UPDATE_NON_BLOCKING allows the application to modify data in the open database in the current transaction. PSE/PSE Pro immediately obtains a write lock on the open database if the write lock is available. If the open database is locked by another session in the same Java VM, PSE/PSE Pro throws com.odi.DatabaseLockedException and the transaction begin operation fails.

Returns:
A Transaction object that represents the transaction that was initiated.

Throws:
DatabaseLockedException - If you specify a nonblocking transaction begin type and the kind of lock needed for the database is not available.
IllegalArgumentException - If the transaction type is not ObjectStore.READONLY, ObjectStore.UPDATE, ObjectStore.READONLY_NON_BLOCKING, or ObjectStore.UPDATE_NON_BLOCKING.
ObjectStoreException - If the current thread is not associated with a session and there is no global session.
TransactionInProgressException - If there is already a transaction in progress.

current

public static Transaction current()
Obtains the instance of Transaction that is associated with the current thread.

Returns:
A Transaction object for the transaction in progress for the current thread.

Throws:
NoTransactionInProgressException - If no transaction is in progress for the current thread.
ObjectStoreException - If the current thread is not associated with a session and there is no global session.

inTransaction

public static boolean inTransaction()
Determines whether or not there is a transaction in progress in the session to which the current thread belongs.

Returns:
The true constant if there is a transaction in progress for the session to which the current thread belongs. The false constant if a transaction is not in progress. This method also returns false if the current thread is not associated with a session. This behavior is compatible with previous releases of PSE/PSE Pro, but it is not consistent with other methods. Other methods throw ObjectStoreException when the current thread does not belong to a session.

commit

public abstract void commit()
Commits a transaction. This ends the transaction. When PSE/PSE Pro commits a transaction, it


commit

public abstract void commit(int retain)
Commits a transaction and specifies what should happen to persistent objects after the transaction is over. This ends the transaction. When PSE/PSE Pro commits a transaction, it:

  • Checks whether or not there are any transient objects that are referred to by persistent objects. If there are such objects, PSE/PSE Pro stores them in the database.

  • Checks for modified persistent objects. If there are such objects, PSE/PSE Pro saves the changes in the database.

  • Determines the disposition of persistent objects for after the transaction according to the value of the retain argument.

    The retain argument provides a mechanism for using persistent objects between transactions. When you start a new transaction, you can use the references to retained objects. However, if you retained the contents of the objects, (if you specified ObjectStore.RETAIN_READONLY or ObjectStore.RETAIN_UPDATE) the state of these objects might have been changed since the commit operation by another process. PSE/PSE Pro automatically refreshes the state of any modified objects, when they are first touched in the new transaction. This means that the application code cannot assume that the state of a retained object remains constant even when a new transaction is started. It is also possible that trying to read or write a retained object in a new transaction could result in a transaction waiting for a lock.

    Parameters:
    retain - Possible values are:

    • ObjectStore.RETAIN_STALE -- Resets the contents of persistent objects to default values and makes all persistent objects stale. This is the same as calling commit().

    • ObjectStore.RETAIN_HOLLOW -- Resets the contents of persistent objects to default values but makes them hollow. References to objects from this transaction can be used in the next one.

    • ObjectStore.RETAIN_READONLY -- Retains persistent objects and their contents. Objects whose contents were available in this transaction can be read between the end of this transaction and the start of the next transaction. If you attempt to modify a persistent object before the next transaction PSE/PSE Pro throws NoTransactionInProgressException.

    • ObjectStore.RETAIN_UPDATE -- Retains persistent objects and their contents and allows modifications. Objects whose contents were available in this transaction can be read or modified between the end of this transaction and the start of the next transaction. PSE/PSE Pro discards any modifications to persistent objects at the start of the next transaction. During the next transaction, objects that you modified contain the most recent contents of the object in the database.

    • ObjectStore.RETAIN_TRANSIENT -- All persistent objects associated with the session are converted into transient objects. These objects are no longer associated with a database and can be read or modified outside transactions. They are not made hollow at the start of the next transaction, because they are transient. Your are responsible for obtaining the contents of the object before you commit or abort by explictly fetching the objects.

    Additional information about hollow, active, and stale object state is the API User Guide.

    For additional information about retaining persistent objects, see the API User Guide.

    AbortException - If PSE/PSE Pro reaches an object while it is performing transitive persistence and that object is not persistence-capable.
    IllegalArgumentException - If retain is not one of ObjectStore.RETAIN_STALE, ObjectStore.RETAIN_HOLLOW, ObjectStore.RETAIN_READONLY, ObjectStore.RETAIN_UPDATE or ObjectStore.RETAIN_TRANSIENT.
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

  • abort

    public abstract void abort()
    Aborts a transaction. abort() restores the persistent state to what it was when the transaction was started. If you opened any databases during the aborted transaction, PSE/PSE Pro closes them. Any databases that were open before the aborted transaction was started remain open.

    Objects that were referenced in the transaction are retained according to the value of Transaction.setDefaultAbortRetain(). If Transaction.setDefaultAbortRetain() has not been called, calling abort() is the same as calling abort(ObjectStore.RETAIN_STALE).

    Sometimes, when PSE/PSE Pro throws an exception, it also aborts the current transaction. If it does, you must not call the abort() method if you catch the exception. The exceptions that can abort transactions are

    If you set up an exception handler that handles one of these exceptions, the handler body must not call abort() unless it has determined that there is still a transaction in progress. You can call Transaction.inTransaction() to determine if there is a transaction in progress.

    You can call Transaction.isAborted() to determine if the transaction has been aborted. You can call Transaction.isActive() to verify that the transaction has not been aborted or committed.

    Throws:
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

    abort

    public abstract void abort(int retain)
    Aborts a transaction and retains objects that were referenced in the transaction. The value you specify for the retain argument determines the state of the retained objects. The abort operation restores the persistent state to what it was when the transaction was started. If you opened any databases during the aborted transaction, PSE/PSE Pro closes them. Any databases that were open before the aborted transaction was started remain open.

    The retain argument provides a mechanism for using persistent objects between transactions. When you start a new transaction, you can use the references to retained objects. However, if you retained the contents of the objects, (if you specified ObjectStore.RETAIN_READONLY or ObjectStore.RETAIN_UPDATE) the state of these objects might have been changed since the abort operation by another process. PSE/PSE Pro automatically refreshes the state of any modified objects, when they are first touched in the new transaction. This means that the application code cannot assume that the state of a retained object remains constant even when a new transaction is started. It is also possible that trying to read or write a retained object in a new transaction could result in a transaction waiting for a lock, or a transaction abort due to a deadlock situation.

    Sometimes, when PSE/PSE Pro throws an exception, it also aborts the current transaction. If it does, you must not call the abort() method if you catch the exception. The exceptions that can abort transactions are

  • ObjectStoreException
  • FatalException or any of its descendents
  • AbortException or any of its descendents

    If you set up an exception handler that handles one of these exceptions, the handler body must not call abort() unless it has determined that there is still a transaction in progress. You can call Transaction.inTransaction() to determine if there is a transaction in progress.

    You can call Transaction.isAborted() to determine if the transaction has been aborted. You can call Transaction.isActive() to verify that the transaction has not been aborted or committed.

    Parameters:
    retain - Possible values are:

    • ObjectStore.RETAIN_STALE -- Resets the contents of all persistent objects to their default values and makes them stale. This is the same as calling abort() when Transaction.setDefaultAbortRetain() has either not been called or been called with ObjectStore.RETAIN_STALE as its argument.

    • ObjectStore.RETAIN_HOLLOW -- Resets the contents of all persistent objects to default values but retains them. In the next transaction, you can use references to persistent objects from this transaction.

    • ObjectStore.RETAIN_READONLY -- Retains the contents of unmodified persistent objects that were read during the aborted transaction. Any objects that were modified become hollow objects, as if ObjectStore.RETAIN_HOLLOW had been specified. Objects whose contents were not modified in the aborted transaction can be read after the aborted transaction. If you try to modify a persistent object before the next transaction, PSE/PSE Pro throws NoTransactionInProgressException. If you modified any persistent objects during the aborted transaction, PSE/PSE Pro discards these modifications and makes these objects hollow as part of the abort operation. During the next transaction, the contents of persistent objects that were not modified during the aborted transaction are still available.

    • ObjectStore.RETAIN_UPDATE -- Retains the contents of persistent objects as well as the objects themselves. The values that are retained are the last values that the objects contained before the transaction was aborted. Even though the changes to to the modified objects are undone with regard to the database, the changes are not undone in the objects in the Java VM. While you are between transactions, the changes that were aborted are still visible in the Java objects. At the start of the next transaction, PSE/PSE Pro discards the modifications and reads in the contents from the database. Objects that were read or modified in the aborted transaction can be modified between the aborted transaction and the next transaction. If you modify any persistent objects during or after the aborted transaction, PSE/PSE Pro discards these modifications and makes these objects hollow at the start of the next transaction. During the next transaction, the contents of persistent objects that were not modified during or after the aborted transaction are still available.
    • ObjectStore.RETAIN_TRANSIENT -- All persistent objects associated with the session are converted into transient objects. These objects are no longer associated with a database and can be read or modified outside transactions. They are not made hollow at the start of the next transaction, because they are transient.

    Throws:
    IllegalArgumentException - If the value of the retain argument is not one of ObjectStore.RETAIN_STALE, ObjectStore.RETAIN_HOLLOW, ObjectStore.RETAIN_READONLY, ObjectStore.RETAIN_UPDATE or ObjectStore.RETAIN_TRANSIENT.
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

  • checkpoint

    public abstract void checkpoint()
    Checkpoints a transaction. A transaction checkpoint is similar to a transaction commit followed by beginning a new transaction and acquiring read locks on most everything that was locked in the previous transaction. A transaction checkpoint is an efficient way to make database changes made in the current transaction permanent and permit an MVCC refresh (resynchronization) opportunity. After a checkpoint, locks on objects locked for update are at most retained as read locks.

    Objects that were referenced in the transaction are retained according to the value of Transaction.setDefaultCommitRetain() or setDefaultRetain(). If neither of these methods has been called, calling checkpoint() is the same as calling checkpoint(ObjectStore.RETAIN_STALE).

    Throws:
    AbortException - If PSE/PSE Pro detects a reference from an object in one segment to an unexported object in another segment, or if PSE/PSE Pro reaches an object while it is performing transitive persistence and that object is not persistence-capable.
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

    checkpoint

    public abstract void checkpoint(int retain)
    Checkpoints a transaction. A transaction checkpoint is similar to a transaction commit followed by beginning a new transaction and acquiring read locks on most everything that was locked in the previous transaction. A transaction checkpoint is an efficient way to make database changes made in the current transaction permanent and permit an MVCC refresh (resynchronization) opportunity. After a checkpoint, locks on objects locked for update are at most retained as read locks.

    The retain argument determines the disposition of persistent objects after the checkpoint. Because checkpoint() immediately starts a new transaction after committing the current one, the retain argument does not affect the behavior of persistent objects outside of a transaction.

    Parameters:
    retain - Possible values are:

    • ObjectStore.RETAIN_STALE resets the contents of persistent objects to default values and makes all persistent objects stale.
    • ObjectStore.RETAIN_HOLLOW resets the contents of persistent objects to default values but makes them hollow. References to objects from this transaction can be used in the new transaction started by checkpoint().

  • ObjectStore.RETAIN_READONLY retains persistent objects and their contents. Objects whose contents were available in this this transaction can continue to be read, without being fetched again from the database in the new transaction. This option is not currently supported in OSJI.

  • ObjectStore.RETAIN_UPDATE is converted to ObjectStore.RETAIN_HOLLOW.

  • ObjectStore.RETAIN_TRANSIENT is converted to ObjectStore.RETAIN_HOLLOW.

    Throws:
    AbortException - If PSE/PSE Pro detects a reference from an object in one segment to an unexported object in another segment, or if PSE/PSE Pro reaches an object while it is performing transitive persistence and that object is not persistence-capable.
    IllegalArgumentException - If retain is not one of ObjectStore.RETAIN_STALE or ObjectStore.RETAIN_HOLLOW.
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

  • setDefaultRetain

    public static void setDefaultRetain(int retain)
    Sets the default retain operation for the current session for calls to Transaction.abort(), Transaction.commit() and Transaction.checkpoint() that have no argument.

    The default retain type for aborts, commits and checkpoints is set by the most recent call to setDefaultRetain(int), setDefaultAbortRetain(int) or setDefaultCommitRetain(int) as appropriate. For example, calling setDefaultAbortRetain(int) after calling setDefaultRetain(int) will set the default retain value for aborts to be that specified by setDefaultAbortRetain(int). Similarly calling setDefaultRetain(int) after calling setDefaultCommitRetain(int) will set the default retain value for checkpoints and commits to be that specified by setDefaultRetain(int).

    Parameters:
    retain - The retain type. See Transaction.abort(int retainType) or Transaction.commit(int retainType) for a description of the retain types.

    Throws:
    NoSessionException - If the calling thread is not joined to a session.
    IllegalArgumentException - If retain is not one of ObjectStore.RETAIN_STALE, ObjectStore.RETAIN_HOLLOW, ObjectStore.RETAIN_READONLY, ObjectStore.RETAIN_UPDATE or ObjectStore.RETAIN_TRANSIENT.
    See Also:
    Transaction.setDefaultAbortRetain(int), Transaction.setDefaultCommitRetain(int), Transaction.abort(), Transaction.commit()

    setDefaultAbortRetain

    public static void setDefaultAbortRetain(int retain)
    Sets the default retain operation for the current session for calls to Transaction.abort() that have no argument.

    Parameters:
    retain - Possible values are:

    • ObjectStore.RETAIN_STALE causes abort() to reset the contents of all persistent objects to their default values and makes them stale.

    • ObjectStore.RETAIN_HOLLOW causes abort() to reset the contents of all persistent objects to default values but retain them as hollow objects.

    • ObjectStore.RETAIN_READONLY causes abort() to retain the contents of persistent objects as well as the objects themselves. The values that are retained are the last values that the objects contained before the transaction was aborted. Objects whose contents were available in the aborted transaction can be read after the aborted transaction. If you try to modify a persistent object before the next transaction, PSE/PSE Pro throws NoTransactionInProgressException. If you modified any persistent objects during the aborted transaction, PSE/PSE Pro discards these modifications and makes these objects hollow at the start of the next transaction. During the next transaction, the contents of persistent objects that were not modified during the aborted transaction are still available.

    • ObjectStore.RETAIN_UPDATE causes abort() to retain the contents of persistent objects as well as the objects themselves. The values that are retained are the last values that the objects contained before the transaction was aborted. Objects whose contents were available in the aborted transaction can be modified between the aborted transaction and the next transaction. If you modified any persistent objects during or after the aborted transaction, PSE/PSE Pro discards these modifications and makes these objects hollow at the start of the next transaction. During the next transaction, the contents of persistent objects that were not modified during or after the aborted transaction are still available.

    • ObjectStore.RETAIN_TRANSIENT causes abort() to convert all persistent objects associated with the session into transient objects. These objects are no longer associated with a database and can be read or modified outside transactions. They are not made hollow at the start of the next transaction, because they are transient.

    Throws:
    NoSessionException - If the calling thread is not joined to a session.
    IllegalArgumentException - If retain is not one of ObjectStore.RETAIN_STALE, ObjectStore.RETAIN_HOLLOW, ObjectStore.RETAIN_READONLY, ObjectStore.RETAIN_UPDATE or ObjectStore.RETAIN_TRANSIENT.

    setDefaultCommitRetain

    public static void setDefaultCommitRetain(int retain)
    Sets the default retain operation for the current session for calls to Transaction.checkpoint() and Transaction.commit() that have no argument.

    Parameters:
    retain - Possible values are:

    • ObjectStore.RETAIN_STALE causes commit() to reset the contents of all persistent objects to their default values and makes them stale.

    • ObjectStore.RETAIN_HOLLOW causes commit() to reset the contents of all persistent objects to default values but retain them as hollow objects.

    • ObjectStore.RETAIN_READONLY causes commit() to retain the contents of persistent objects as well as the objects themselves. The values that are retained are the last values that the objects contained when the transaction was committed. Objects whose contents were available in the committed transaction can be read after the aborted transaction. If you try to modify a persistent object before the next transaction, PSE/PSE Pro throws NoTransactionInProgressException.

    • ObjectStore.RETAIN_UPDATE causes abort() to retain the contents of persistent objects as well as the objects themselves. The values that are retained are the last values that the objects contained when the transaction was committed. Objects whose contents were available in the committed transaction can be modified between the committed transaction and the next transaction. If you modify any persistent objects between transactions, PSE/PSE Pro discards these modifications and makes these objects hollow at the start of the next transaction.

    • ObjectStore.RETAIN_TRANSIENT -- causes commit() to convert all persistent objects associated with the session into transient objects. These objects are no longer associated with a database, and can be read, or modified, outside transactions. They are not made hollow at the start of the next transaction, since they are transient.

    The default retain type for aborts, commits and checkpoints is set by the most recent call to setDefaultRetain(int), setDefaultAbortRetain(int) or setDefaultCommitRetain(int) as appropriate. For example, calling setDefaultAbortRetain(int) after calling setDefaultRetain(int) will set the default retain value for aborts to be that specified by setDefaultAbortRetain(int). Similarly calling setDefaultRetain(int) after calling setDefaultCommitRetain(int) will set the default retain value for checkpoints and commits to be that specified by setDefaultRetain(int).

    Throws:
    NoSessionException - If the calling thread is not joined to a session.
    IllegalArgumentException - If retain is not one of ObjectStore.RETAIN_STALE, ObjectStore.RETAIN_HOLLOW, ObjectStore.RETAIN_READONLY, ObjectStore.RETAIN_UPDATE or ObjectStore.RETAIN_TRANSIENT.

    getType

    public abstract int getType()
    Obtains the type of a transaction.

    Returns:
    ObjectStore.READONLY, ObjectStore.UPDATE, ObjectStore.READONLY_NON_BLOCKING, or ObjectStore.UPDATE_NON_BLOCKING.

    Throws:
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

    hasLockContention

    public static boolean hasLockContention()
    Indicates whether or not a Server involved in the current transaction has experienced contention for some persistent objects that the application is using.

    This function can be used in conjunction with MVCC to help determine whether or not to start a new transaction to make available more up-to-date data. If your application has a database open for MVCC, and during the current transaction another application has write-locked an object read by your application, hasLockContention() returns true.

    This method is advisory; it does not have to be called and its return value can be ignored without jeopardizing the correctness of PSE/PSE Pro's behavior.

    Returns:
    True If there is lock contention, otherwise false. Always returns false in PSE and PSE Pro.
    Throws:
    NoTransactionInProgressException - If a transaction is not in progress.
    ObjectStoreException - If the session implied by the transaction has been terminated or if the current thread is associated with a session other than the session implied by the transaction.

    getPriority

    public static int getPriority()
    Gets the priority specified for transactions started by the current session.

    Returns:
    This method always returns 0 in PSE and PSE Pro.

    Throws:
    ObjectStoreException - If the current thread is not associated with a session and there is no global session.
    See Also:
    Transaction.setPriority(int)

    setPriority

    public static void setPriority(int priority)
    Sets the priority for transactions started by the current session.

    This method has no effect in PSE or PSE Pro.

    Parameters:
    priority - The transaction priority.

    Throws:
    IllegalArgumentException - If the priority argument is negative or greater than 0xffff.
    ObjectStoreException - If the current thread is not associated with a session and there is no global session.

    getSession

    public abstract Session getSession()
    Returns the session associated with this Transaction. Returns null if the session has been terminated.

    Returns:
    The session or null.


    isAborted

    public abstract boolean isAborted()
    Returns true if the transaction has been aborted, otherwise false. Note that this entrypoint does not require the calling thread to belong to a session or for the session that started the transaction to be active.


    isActive

    public abstract boolean isActive()
    Returns true if the transaction has not been aborted or committed, otherwise false. Note that this entrypoint does not require the calling thread to belong to a session or for the session that started the transaction to be active.



    Copyright 2005 Progress Software Corporation. All rights reserved.