| java.lang.Object org.ozoneDB.AbstractTransaction org.ozoneDB.ExternalTransaction
ExternalTransaction | final public class ExternalTransaction extends AbstractTransaction implements Referenceable(Code) | | ExternalTransaction allows an application to explicitly manage transaction
boundaries.
When programming ozone applications explicite transaction demarcation is
needed under rare circumstances only (for example: processing of binary large
objects - BLOBs). In fact, in most cases explicite transactions are not
really needed while implicite transactions are cleaner and faster. So, every
time you are going to use explicite transactions, you should ask yourself if
an implicite transaction is maybe a better choice.
In case of a deadlock the ordinary behaviour of ozone is to abort one of the
locked transactions and restart until all transactions are successfully
commited. This is not possible when explicite transactions are used! In case
of deadlock an exceptions is thrown and the client has to decide what to do.
Note: If an operation that runs under control of this transaction fails, the
transaction is set to rollback only.
author: SMB version: $Revision: 1.1 $Date: 2001/12/18 10:31:30 $ |
Field Summary | |
final public static int | STATUS_ACTIVE Status of a transaction: transaction has been started. | final public static int | STATUS_COMMITED Status of a transaction: transaction has been successfully committed. | final public static int | STATUS_COMMITING Status of a transaction: transaction is about to commit. | final public static int | STATUS_NONE Status of a transaction: transaction is not active. | final public static int | STATUS_PREPARED Status of a transaction: transaction has been successfully prepared. | final public static int | STATUS_PREPARING Status of a transaction: transaction is about to prepare. | final public static int | STATUS_ROLLEDBACK Status of a transaction: transaction has been aborted. | final public static int | STATUS_ROLLINGBACK Status of a transaction: transaction is about to abort. | protected boolean | rollbackOnly |
Method Summary | |
public void | begin() Start work on behalf of this transaction and associate it with the current
thread. | public void | checkpoint() Checkpoint this transaction. | public void | commit() Complete this transaction. | public void | commit(boolean onePhase) Complete this transaction. | public static ExternalTransaction | getInstance() | public Object | getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable env) | public Reference | getReference() Retrieves the JNDI Reference of this object. | public int | getStatus() Obtain the status of the transaction associated with the current thread. | public void | join() Attach the caller's thread to this transaction and detach the thread
from any former Transaction the thread may have been associated with. | public void | leave() Detach the caller's thread from this Transaction , but do not attach
the thread to another Transaction . | public void | prepare() Prepares this transaction. | public void | rollback() Rollback the transaction associated with the current thread. | public synchronized void | setRollbackOnly() Modify the transaction associated with the current thread such that the
only possible outcome of the transaction is to roll back the transaction. | public void | setTransactionTimeout(int seconds) Modify the value of the timeout value that is associated with the
transactions started by the current thread with the begin method.
If an application has not called this method, the transaction service
uses some default value for the transaction timeout.
Parameters: seconds - The value of the timeout in seconds. |
STATUS_ACTIVE | final public static int STATUS_ACTIVE(Code) | | Status of a transaction: transaction has been started.
|
STATUS_COMMITED | final public static int STATUS_COMMITED(Code) | | Status of a transaction: transaction has been successfully committed.
|
STATUS_COMMITING | final public static int STATUS_COMMITING(Code) | | Status of a transaction: transaction is about to commit.
|
STATUS_NONE | final public static int STATUS_NONE(Code) | | Status of a transaction: transaction is not active.
|
STATUS_PREPARED | final public static int STATUS_PREPARED(Code) | | Status of a transaction: transaction has been successfully prepared.
|
STATUS_PREPARING | final public static int STATUS_PREPARING(Code) | | Status of a transaction: transaction is about to prepare.
|
STATUS_ROLLEDBACK | final public static int STATUS_ROLLEDBACK(Code) | | Status of a transaction: transaction has been aborted.
|
STATUS_ROLLINGBACK | final public static int STATUS_ROLLINGBACK(Code) | | Status of a transaction: transaction is about to abort.
|
rollbackOnly | protected boolean rollbackOnly(Code) | | |
begin | public void begin() throws TransactionExc, IOException(Code) | | Start work on behalf of this transaction and associate it with the current
thread.
throws: TransactionExc - If the thread is already associated with atransaction. throws: IOException - If the server is not reachable. |
checkpoint | public void checkpoint() throws TransactionExc, IOException(Code) | | Checkpoint this transaction. This method can also be called by a
non-joined thread.
|
commit | public void commit() throws TransactionExc, IOException(Code) | | Complete this transaction. When this method completes, the thread
becomes associated with no transaction. This method can be called by a
non-joined thread.
|
commit | public void commit(boolean onePhase) throws TransactionExc, IOException(Code) | | Complete this transaction. When this method completes, the thread
becomes associated with no transaction. This method is intended to be
used by transactional applications that need two-phase commit.
|
getReference | public Reference getReference() throws NamingException(Code) | | Retrieves the JNDI Reference of this object.
The non-null Reference of this object. |
join | public void join() throws TransactionExc, IOException(Code) | | Attach the caller's thread to this transaction and detach the thread
from any former Transaction the thread may have been associated with.
|
leave | public void leave() throws TransactionExc, IOException(Code) | | Detach the caller's thread from this Transaction , but do not attach
the thread to another Transaction .
|
prepare | public void prepare() throws TransactionExc, IOException(Code) | | Prepares this transaction. This method is intended to be used by
transactional applications that need two-phase commit.
|
rollback | public void rollback() throws TransactionExc, IOException(Code) | | Rollback the transaction associated with the current thread. When this
method completes, the thread becomes associated with no transaction.
Calling this method when the transaction is not opened doe not throw
an exception.
This method can be called by any threads.
|
setRollbackOnly | public synchronized void setRollbackOnly() throws TransactionExc, IOException(Code) | | Modify the transaction associated with the current thread such that the
only possible outcome of the transaction is to roll back the transaction.
|
setTransactionTimeout | public void setTransactionTimeout(int seconds) throws TransactionExc, IOException(Code) | | Modify the value of the timeout value that is associated with the
transactions started by the current thread with the begin method.
If an application has not called this method, the transaction service
uses some default value for the transaction timeout.
Parameters: seconds - The value of the timeout in seconds. If the value is zero,the transaction service restores the default value |
|
|