|
|||||||||||
| 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 | |
void |
associateThreadTx(Xid xid)
Associate Thread to this transaction. |
void |
begin()
Creates a new transaction and associate it with the current thread. |
void |
begin(Xid xid)
Creates a new inflow transaction and associates it with the current thread. |
void |
begin(Xid xid,
long timeout)
Creates a new inflow transaction and associates it with the current thread. |
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. |
static Current |
getCurrent()
Returns the unique instance of the class or null if not
initialized in case of plain client. |
int |
getDefaultTimeout()
Gets the default timeout value |
static TransactionFactory |
getJTM()
Returns the TMFactory (in JTM) |
Xid[] |
getPreparedHeuristicXid()
Get the transaction referenced by Xid. |
TransactionContext |
getPropagationContext(boolean hold)
Get the transaction context associated with the current thread or null if the thread is not involved in a transaction. |
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. |
Transaction |
getTransaction()
Gets the transaction object that represents the transaction context of the calling thread. |
Integer[] |
getTransactionCounters()
Returns all counters. |
static TransactionManager |
getTransactionManager()
Gets the TransactionManager instance. |
TransactionImpl |
getTxByXid(Xid xid)
Get the transaction referenced by Xid. |
XATerminator |
getXATerminator()
Gets the inflow transaction object that represents the transaction context of the calling thread. |
List |
popThreadLocalRMEventList()
Pop the current set from the stack of thread local resource event sets The list contains ResourceManagerEvent objects. |
void |
pushThreadLocalRMEventList(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(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. |
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 |
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. |
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 NotSupportedException,
SystemException
begin in interface UserTransactionNotSupportedException - Thrown if the thread is already
associated with a transaction. (nested transaction are not
supported)
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void begin(Xid xid)
throws NotSupportedException,
SystemException
xid - Xid of the inflow transaction.
NotSupportedException - Thrown if the thread is already
associated with a transaction. (nested transaction are not
supported)
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void begin(Xid xid,
long timeout)
throws NotSupportedException,
SystemException
xid - Xid of the inflow transaction.timeout - value of the timeout (in seconds). If the value is zero,
the transaction service restores the default value.
NotSupportedException - Thrown if the thread is already
associated with a transaction. (nested transaction are not
supported)
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public XATerminator getXATerminator()
throws XAException
XAException - Thrown if the transaction manager
encounters an unexpected error condition
public void commit()
throws RollbackException,
HeuristicMixedException,
HeuristicRollbackException,
SecurityException,
IllegalStateException,
SystemException
commit in interface UserTransactionRollbackException - Thrown to indicate that the transaction
has been rolled back rather than committed.
HeuristicMixedException - Thrown to indicate that a heuristic
decision was made and that some relevant updates have been committed
while others have been rolled back.
HeuristicRollbackException - Thrown to indicate that a
heuristic decision was made and that some relevant updates have been
rolled back.
SecurityException - Thrown to indicate that the thread is not
allowed to commit the transaction.
IllegalStateException - Thrown if the current thread is not
associated with a transaction.
SystemException - Thrown if the transaction manager encounters
an unexpected error condition
public void rollback()
throws IllegalStateException,
SecurityException,
SystemException
rollback in interface UserTransactionSecurityException - Thrown to indicate that the thread is not
allowed to roll back the transaction.
IllegalStateException - Thrown if the current thread is not
associated with a transaction.
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void setRollbackOnly()
throws IllegalStateException,
SystemException
setRollbackOnly in interface UserTransactionIllegalStateException - Thrown if the current thread is not
associated with a transaction.
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public int getStatus()
throws SystemException
getStatus in interface UserTransactionSystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void setTransactionTimeout(int timeout)
throws SystemException
setTransactionTimeout in interface UserTransactiontimeout - value of the timeout (in seconds). If the value is zero,
the transaction service restores the default value.
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public Transaction getTransaction()
throws SystemException
getTransaction in interface TransactionManagerSystemException - Thrown if the transaction manager
encounters an unexpected error condition
public void resume(Transaction tobj)
throws InvalidTransactionException,
IllegalStateException,
SystemException
Warning: No XA start is done here. We suppose it is already
done after a getConnection().
getConnection()connection.close()
resume in interface TransactionManagertobj - The Transaction object that represents the
transaction to be resumed.
InvalidTransactionException - Thrown if the parameter
transaction object contains an invalid transaction
IllegalStateException - Thrown if the thread is already
associated with another transaction.
SystemException - Thrown if the transaction manager
encounters an unexpected error condition
public Transaction suspend()
throws 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 TransactionManagerSystemException - Thrown if the transaction manager
encounters an unexpected error condition
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(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 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 Reference getReference()
throws NamingException
Reference of this object.
getReference in interface ReferenceableReference of this object.
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 void setDefaultTimeout(int timeout)
timeout - timeout value (in seconds)public int getDefaultTimeout()
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 Xid[] getPreparedHeuristicXid()
public void associateThreadTx(Xid xid)
public int getTotalCurrentTransactions()
public int getTotalBegunTransactions()
public int getTotalRolledbackTransactions()
public int getTotalCommittedTransactions()
public void resetAllTxTotalCounters()
public int getTotalExpiredTransactions()
public Integer[] getTransactionCounters()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||