|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jonas_tm.Current
Current is the common Implementation for UserTransaction and TransactionManager. UserTransaction is used by clients that want manage transactions themselves. It is referenceable via JNDI TransactionManager is used by an EJBServer. This object is unique in a VM, i.e. each EJBServer has ONE Current object and each client program should normally issue only ONE lookup on JNDI. Current also implements Referenceable, because of JNDI.
Constructor Summary | |
Current()
Default constructor. |
|
Current(TransactionFactory tmfact)
Constructor for EJBServer. |
Method Summary | |
void |
begin()
Create a new transaction and associate it with the current thread. |
void |
commit()
Complete the transaction associated with the current thread. |
void |
connectionClosed(ResourceManagerEvent event)
Call back from a resource manager indicating that a close has been called on a connection that had been opened before a transaction had begun |
void |
connectionErrorOccured(ResourceManagerEvent event)
Call back from a resource manager indicating that an error has occured on a connection that had been opened before a transaction had begun |
void |
connectionOpened(ResourceManagerEvent event)
Call back from a resource manager indicating that a connection has been opened before a transaction had begun |
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 |
getCurrentNumberOfTx()
MBean method: |
int |
getDefaultTimeout()
Gets the default timeout value |
static TransactionFactory |
getJTM()
Returns the TMFactory (in JTM) |
TransactionContext |
getPropagationContext(boolean hold)
Get the propagation 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()
Obtain the status of the transaction associated with the current thread. |
int |
getTotalNumberOfBeginTx()
MBean method: |
int |
getTotalNumberOfCommitTx()
MBean method: |
int |
getTotalNumberOfRollbackTx()
MBean method: |
int |
getTotalNumberOfTimeOutExpired()
management method: |
Transaction |
getTransaction()
Get the transaction object that represents the transaction context of the calling thread. |
static TransactionManager |
getTransactionManager()
|
Integer[] |
getTxCounters()
management method: |
void |
incrementBeginCounter()
management method: increment the number of beginned tx |
void |
incrementCommitCounter()
management method: increment the number of beginned tx |
void |
incrementRollbackCounter()
management method: increment the number of rollbacked tx |
void |
incrementTimeOutExpCounter()
management method: increment the number of rollbacked by time out |
List |
popThreadLocalRMEventList()
Pop the current list from the stack of thread local resource event lists |
void |
pushThreadLocalRMEventList(List eventList)
Push a new empty list on the stack of thread local resource event lists |
void |
resetAllTxTotalCounters()
MBean method: reset total number of tx |
void |
resume(Transaction tobj)
Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object. |
void |
rollback()
Roll 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 propagation 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 seconds)
Modify the value of the timeout value that is associated with the transactions started by the current thread with the begin method. |
Transaction |
suspend()
Suspend 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)
Method Detail |
public static TransactionManager getTransactionManager()
public void begin() throws NotSupportedException, SystemException
begin
in interface UserTransaction
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 conditionpublic void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
commit
in interface UserTransaction
RollbackException
- 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 conditionpublic void rollback() throws IllegalStateException, SecurityException, SystemException
rollback
in interface UserTransaction
SecurityException
- 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 conditionpublic void setRollbackOnly() throws IllegalStateException, SystemException
setRollbackOnly
in interface UserTransaction
IllegalStateException
- Thrown if the current thread is
not associated with a transaction.
SystemException
- Thrown if the transaction manager
encounters an unexpected error conditionpublic int getStatus() throws SystemException
getStatus
in interface UserTransaction
SystemException
- Thrown if the transaction manager
encounters an unexpected error conditionpublic void setTransactionTimeout(int seconds) throws SystemException
If an application has not called this method, the transaction service uses some default value for the transaction timeout.
setTransactionTimeout
in interface UserTransaction
seconds
- The 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 conditionpublic Transaction getTransaction() throws SystemException
getTransaction
in interface TransactionManager
SystemException
- Thrown if the transaction manager
encounters an unexpected error conditionpublic void resume(Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException
resume
in interface TransactionManager
tobj
- 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 conditionpublic Transaction suspend() throws SystemException
suspend
in interface TransactionManager
SystemException
- 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)
connectionOpened
in interface ResourceManagerEventListener
event
- event sent to the listenerpublic void connectionClosed(ResourceManagerEvent event)
connectionClosed
in interface ResourceManagerEventListener
public void connectionErrorOccured(ResourceManagerEvent event)
connectionErrorOccured
in interface ResourceManagerEventListener
event
- event sent to the listenerpublic void pushThreadLocalRMEventList(List eventList)
pushThreadLocalRMEventList
in interface TransactionManager
eventList
- the possibly null list of events to store forecoming
ResourceManagerEvent
events occuring in the current thread.public List popThreadLocalRMEventList()
popThreadLocalRMEventList
in interface TransactionManager
ResourceManagerEvent
list of events
that have occured in the current thread since the last call of
pushThreadLocalRMEventList
or since the thread started.public Reference getReference() throws NamingException
getReference
in interface Referenceable
NamingException
- If a naming exception was encountered while retrieving the reference.public static Current getCurrent()
public static TransactionFactory getJTM()
public void setDefaultTimeout(int timeout)
public int getDefaultTimeout()
public void setPropagationContext(TransactionContext pctx, boolean isReply)
public TransactionContext getPropagationContext(boolean hold)
public void forgetTx(Xid xid)
public int getCurrentNumberOfTx()
public void incrementBeginCounter()
public int getTotalNumberOfBeginTx()
public void incrementRollbackCounter()
public int getTotalNumberOfRollbackTx()
public void incrementCommitCounter()
public int getTotalNumberOfCommitTx()
public void resetAllTxTotalCounters()
public void incrementTimeOutExpCounter()
public int getTotalNumberOfTimeOutExpired()
public Integer[] getTxCounters()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |