|
ozone API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.AbstractTransaction
org.ozoneDB.ExternalTransaction
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.
Field Summary | |
static int |
STATUS_ACTIVE
Status of a transaction: transaction has been started. |
static int |
STATUS_COMMITED
Status of a transaction: transaction has been successfully committed. |
static int |
STATUS_COMMITING
Status of a transaction: transaction is about to commit. |
static int |
STATUS_NONE
Status of a transaction: transaction is not active. |
static int |
STATUS_PREPARED
Status of a transaction: transaction has been successfully prepared. |
static int |
STATUS_PREPARING
Status of a transaction: transaction is about to prepare. |
static int |
STATUS_ROLLEDBACK
Status of a transaction: transaction has been aborted. |
static int |
STATUS_ROLLINGBACK
Status of a transaction: transaction is about to abort. |
Constructor Summary | |
ExternalTransaction(ExternalDatabase _database)
|
Method Summary | |
void |
begin()
Start work on behalf of this transaction and associate it with the current thread. |
void |
checkpoint()
Checkpoint this transaction. |
void |
commit()
Complete this transaction. |
void |
commit(boolean onePhase)
Complete this transaction. |
static ExternalTransaction |
getInstance()
|
java.lang.Object |
getObjectInstance(java.lang.Object refObj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable env)
|
javax.naming.Reference |
getReference()
Retrieves the JNDI Reference of this object. |
int |
getStatus()
Obtain the status of the transaction associated with the current thread. |
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. |
void |
leave()
Detach the caller's thread from this Transaction , but do not attach
the thread to another Transaction . |
void |
prepare()
Prepares this transaction. |
void |
rollback()
Rollback the transaction associated with the current thread. |
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. |
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. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int STATUS_NONE
public static final int STATUS_ACTIVE
public static final int STATUS_PREPARING
public static final int STATUS_PREPARED
public static final int STATUS_COMMITING
public static final int STATUS_COMMITED
public static final int STATUS_ROLLINGBACK
public static final int STATUS_ROLLEDBACK
Constructor Detail |
public ExternalTransaction(ExternalDatabase _database)
Method Detail |
public void begin() throws TransactionException, java.io.IOException
TransactionException
- If the thread is already associated with a
transaction.
java.io.IOException
- If the server is not reachable.public void join() throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public void leave() throws TransactionException, java.io.IOException
Transaction
, but do not attach
the thread to another Transaction
.
TransactionException
java.io.IOException
public void prepare() throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public void commit() throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public void commit(boolean onePhase) throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public void checkpoint() throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public void rollback() throws TransactionException, java.io.IOException
This method can be called by any threads.
TransactionException
java.io.IOException
public void setRollbackOnly() throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public int getStatus() throws TransactionException, java.io.IOException
TransactionException
java.io.IOException
public void setTransactionTimeout(int seconds) throws TransactionException, java.io.IOException
seconds
- The value of the timeout in seconds. If the value is zero,
the transaction service restores the default value
TransactionException
java.io.IOException
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
public java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable env)
public static ExternalTransaction getInstance()
|
ozone API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |