|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.jotm.Current
Current is the common implementation for both
UserTransaction and TransactionManager.
UserTransaction is used by clients that want to demarcate
transactions themselves. It is referenceable through JNDI.TransactionManager is used by an application server.This object is unique in a VM, i. e. each application server has
ONE Current object and each client program should
normally issue only ONE lookup on JNDI.
Current also implements Referenceable and
Serializable because of JNDI.
| Constructor Summary | |
Current()
Default constructor. |
|
Current(TransactionFactory tmfact)
Constructor for an application server. |
|
| Method Summary | |
int |
actionXAResource(java.lang.String xaAction,
java.lang.String xatx)
|
void |
associateThreadTx(Xid xid)
Associate Thread to this transaction. |
void |
begin()
Creates a new transaction and associate it with the current thread. |
void |
begin(javax.transaction.xa.Xid passxid)
Creates a new inflow transaction and associates it with the current thread. |
void |
begin(javax.transaction.xa.Xid passxid,
long timeout)
Creates a new inflow transaction and associates it with the current thread. |
void |
clearThreadTx()
Clear transaction from this thread if not known. |
void |
commit()
Commits the transaction associated with the current thread. |
void |
connectionClosed(ResourceManagerEvent event)
This method is called by the resource manager when a logical connection that was opened without transaction context is closed. |
void |
connectionErrorOccured(ResourceManagerEvent event)
This method is called by the resource manager when a logical connection that was opened without transaction context is about to throw an exception. |
void |
connectionOpened(ResourceManagerEvent event)
This method is called by the resource manager when a getConnection call is made without a transaction
context. |
void |
forgetTx(Xid xid)
Forget all about this transaction. |
java.lang.String[] |
getAllRcTx()
Get all Transactions that may require recovery. |
java.lang.String[] |
getAllTx()
Get all executing transactions. |
java.lang.String[] |
getAllXaTx(java.lang.String stx)
Get all XAResources that may require recovery. |
javax.transaction.xa.Xid[] |
getAllXid()
Get all Xid's associated with this transaction. |
static Current |
getCurrent()
Returns the unique instance of the class or null if not
initialized in case of plain client. |
static boolean |
getDefaultRecovery()
Gets the default recovery value |
int |
getDefaultTimeout()
Gets the default timeout value |
static TransactionFactory |
getJTM()
Returns the TMFactory (in JTM) |
javax.transaction.xa.Xid[] |
getPreparedHeuristicXid()
Get the Xid's of all prepared transactions. |
TransactionContext |
getPropagationContext(boolean hold)
Get the transaction context associated with the current thread or null if the thread is not involved in a transaction. |
javax.naming.Reference |
getReference()
Retrieves the Reference of this object. |
int |
getStatus()
Returns the status of the transaction associated with the current thread. |
int |
getTotalBegunTransactions()
Returns the total number of begun transactions. |
int |
getTotalCommittedTransactions()
Returns the total number of committed transactions. |
int |
getTotalCurrentTransactions()
Returns the current number of transactions. |
int |
getTotalExpiredTransactions()
Returns the total number of rolled back transactions due to timeout. |
int |
getTotalRolledbackTransactions()
Returns the total number of rolled back transactions. |
javax.transaction.Transaction |
getTransaction()
Gets the transaction object that represents the transaction context of the calling thread. |
java.lang.Integer[] |
getTransactionCounters()
Returns all counters. |
static TransactionManager |
getTransactionManager()
Gets the TransactionManager instance. |
static TransactionRecovery |
getTransactionRecovery()
Returns the Transaction Recovery object |
TransactionImpl |
getTxByXid(Xid xid)
Get the transaction referenced by Xid. |
javax.resource.spi.XATerminator |
getXATerminator()
Gets the inflow transaction object that represents the transaction context of the calling thread. |
java.util.List |
popThreadLocalRMEventList()
Pop the current set from the stack of thread local resource event sets The list contains ResourceManagerEvent objects. |
void |
pushThreadLocalRMEventList(java.util.List eventList)
Push a new event list on the stack of thread local resource event sets. |
void |
resetAllTxTotalCounters()
Resets total number of transactions. |
void |
resume(javax.transaction.Transaction tobj)
Resumes the transaction context association of the calling thread with the transaction represented by the supplied Transaction object. |
void |
rollback()
Rolls back the transaction associated with the current thread. |
static void |
setDefaultRecovery(boolean recovery)
Sets the default recovery value |
void |
setDefaultTimeout(int timeout)
Sets the default timeout value |
void |
setPropagationContext(TransactionContext pctx,
boolean isReply)
Associate to the current thread a transaction represented by its transaction context. |
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 |
setTransactionRecovery(boolean recovery)
Modifies the value of the recovery value that is associated with the transactions started by the current thread with the begin method. |
void |
setTransactionTimeout(int timeout)
Modifies the value of the timeout value that is associated with the transactions started by the current thread with the begin method. |
javax.transaction.Transaction |
suspend()
Suspends the transaction currently associated with the calling thread and return a Transaction object that represents the
transaction context being suspended. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Current()
public Current(TransactionFactory tmfact)
tmfact - TM Factory to use| Method Detail |
public static TransactionManager getTransactionManager()
TransactionManager instance.
public void begin()
throws javax.transaction.NotSupportedException,
javax.transaction.SystemException
begin in interface javax.transaction.UserTransactionjavax.transaction.NotSupportedException - Thrown if the thread is already
associated with a transaction. (nested transaction are not
supported)
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void begin(javax.transaction.xa.Xid passxid)
throws javax.transaction.NotSupportedException,
javax.transaction.SystemException
passxid - Xid of the inflow transaction.
javax.transaction.NotSupportedException - Thrown if the thread is already
associated with a transaction. (nested transaction are not
supported)
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void begin(javax.transaction.xa.Xid passxid,
long timeout)
throws javax.transaction.NotSupportedException,
javax.transaction.SystemException
passxid - Xid of the inflow transaction.timeout - value of the timeout (in seconds). If the value is less than
or equal to zero, the value will be set to the default value.
javax.transaction.NotSupportedException - Thrown if the thread is already
associated with a transaction. (nested transaction are not
supported)
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public javax.resource.spi.XATerminator getXATerminator()
throws javax.transaction.xa.XAException
javax.transaction.xa.XAException - Thrown if the transaction manager
encounters an unexpected error condition
public void commit()
throws javax.transaction.RollbackException,
javax.transaction.HeuristicMixedException,
javax.transaction.HeuristicRollbackException,
java.lang.SecurityException,
java.lang.IllegalStateException,
javax.transaction.SystemException
commit in interface javax.transaction.UserTransactionjavax.transaction.RollbackException - Thrown to indicate that the transaction
has been rolled back rather than committed.
javax.transaction.HeuristicMixedException - Thrown to indicate that a heuristic
decision was made and that some relevant updates have been committed
while others have been rolled back.
javax.transaction.HeuristicRollbackException - Thrown to indicate that a
heuristic decision was made and that some relevant updates have been
rolled back.
java.lang.SecurityException - Thrown to indicate that the thread is not
allowed to commit the transaction.
java.lang.IllegalStateException - Thrown if the current thread is not
associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters
an unexpected error condition
public void rollback()
throws java.lang.IllegalStateException,
java.lang.SecurityException,
javax.transaction.SystemException
rollback in interface javax.transaction.UserTransactionjava.lang.SecurityException - Thrown to indicate that the thread is not
allowed to roll back the transaction.
java.lang.IllegalStateException - Thrown if the current thread is not
associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void setRollbackOnly()
throws java.lang.IllegalStateException,
javax.transaction.SystemException
setRollbackOnly in interface javax.transaction.UserTransactionjava.lang.IllegalStateException - Thrown if the current thread is not
associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public int getStatus()
throws javax.transaction.SystemException
getStatus in interface javax.transaction.UserTransactionjavax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void setTransactionTimeout(int timeout)
throws javax.transaction.SystemException
setTransactionTimeout in interface javax.transaction.UserTransactiontimeout - value of the timeout (in seconds). If the value is zero,
the transaction service restores the default value.
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void setTransactionRecovery(boolean recovery)
throws javax.transaction.SystemException
recovery - value of the recovery (true or faluse). If the value is
false, recovery of transactions is disabled.
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public javax.transaction.Transaction getTransaction()
throws javax.transaction.SystemException
getTransaction in interface javax.transaction.TransactionManagerjavax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void resume(javax.transaction.Transaction tobj)
throws javax.transaction.InvalidTransactionException,
java.lang.IllegalStateException,
javax.transaction.SystemException
Warning: No XA start is done here. We suppose it is already
done after a getConnection().
getConnection()connection.close()
resume in interface javax.transaction.TransactionManagertobj - The Transaction object that represents the
transaction to be resumed.
javax.transaction.InvalidTransactionException - Thrown if the parameter
transaction object contains an invalid transaction
java.lang.IllegalStateException - Thrown if the thread is already
associated with another transaction.
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public javax.transaction.Transaction suspend()
throws javax.transaction.SystemException
Transaction object that represents the
transaction context being suspended.
If the calling thread is not
associated with a transaction, the method returns
null. When this method returns, the calling thread is
associated with no transaction.
Warning: No XA start is done here. We suppose it is already
done after a getConnection().
getConnection()connection.close()
suspend in interface javax.transaction.TransactionManagerjavax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error condition
javax.transaction.SystemException - Thrown if the transaction manager
encounters an unexpected error conditionpublic void connectionOpened(ResourceManagerEvent event)
ResourceManagerEventListenergetConnection call is made without a transaction
context. The ResourceManagerEvent is to be used
by the listener to keep track of those events and perform a late
enrolment of those logical connection when the transaction begins.
connectionOpened in interface ResourceManagerEventListenerevent - event sent to the listenerResourceManagerEventListener.connectionOpened(org.objectweb.transaction.jta.ResourceManagerEvent)public void connectionClosed(ResourceManagerEvent event)
ResourceManagerEventListener
connectionClosed in interface ResourceManagerEventListenerevent - event sent to the listenerResourceManagerEventListener.connectionClosed(org.objectweb.transaction.jta.ResourceManagerEvent)public void connectionErrorOccured(ResourceManagerEvent event)
ResourceManagerEventListener
connectionErrorOccured in interface ResourceManagerEventListenerevent - event sent to the listenerResourceManagerEventListener.connectionErrorOccured(org.objectweb.transaction.jta.ResourceManagerEvent)public void pushThreadLocalRMEventList(java.util.List eventList)
TransactionManagerResourceManagerEvent objects.
pushThreadLocalRMEventList in interface TransactionManagereventList - the possibly null list of events to store forecoming
ResourceManagerEvent events occuring in the current thread.TransactionManager.pushThreadLocalRMEventList(java.util.List)public java.util.List popThreadLocalRMEventList()
TransactionManagerResourceManagerEvent objects.
popThreadLocalRMEventList in interface TransactionManagerResourceManagerEvent
list of events that have occured in the current thread since the last
call of pushThreadLocalRMEventList or since the thread
started.TransactionManager.popThreadLocalRMEventList()
public javax.naming.Reference getReference()
throws javax.naming.NamingException
Reference of this object.
getReference in interface javax.naming.ReferenceableReference of this object.
javax.naming.NamingException - If a naming exception was encountered while retrieving the reference.public static Current getCurrent()
null if not
initialized in case of plain client.
Current object createdpublic static TransactionFactory getJTM()
public static TransactionRecovery getTransactionRecovery()
public void setDefaultTimeout(int timeout)
timeout - timeout value (in seconds)public int getDefaultTimeout()
public static void setDefaultRecovery(boolean recovery)
recovery - recovery value (true or false)public static boolean getDefaultRecovery()
public void setPropagationContext(TransactionContext pctx,
boolean isReply)
isReply =
false)isReply =
true)
pctx - TransactionContextisReply - true before calling a request,
false after receiving a replypublic TransactionContext getPropagationContext(boolean hold)
public void forgetTx(Xid xid)
TransactionImpl must be destroyed to allow
the garbage collector to free memory allocated to this transaction.
xid - Xid of the transactionpublic TransactionImpl getTxByXid(Xid xid)
xid - Xid of the transactionpublic javax.transaction.xa.Xid[] getPreparedHeuristicXid()
public javax.transaction.xa.Xid[] getAllXid()
public java.lang.String[] getAllTx()
public java.lang.String[] getAllRcTx()
public java.lang.String[] getAllXaTx(java.lang.String stx)
public int actionXAResource(java.lang.String xaAction,
java.lang.String xatx)
public void associateThreadTx(Xid xid)
public void clearThreadTx()
public int getTotalCurrentTransactions()
public int getTotalBegunTransactions()
public int getTotalRolledbackTransactions()
public int getTotalCommittedTransactions()
public void resetAllTxTotalCounters()
public int getTotalExpiredTransactions()
public java.lang.Integer[] getTransactionCounters()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||