public class TransactionImpl extends java.lang.Object implements Transaction, AlarmListener
Modifier and Type | Method and Description |
---|---|
boolean |
allowLocalTransactionOptimization()
Returns true if the local transaction optimization would be allowed.
|
void |
close()
Close the transaction, rolling back everything and removing all enlisted
resources.
|
void |
commit()
Commit the transaction.
|
boolean |
delistResource(XAResource resource,
int flag)
De-lists a resource from the current transaction
|
boolean |
enlistResource(XAResource resource)
Enlists a resource with the current transaction.
|
java.lang.Object |
getAttribute(java.lang.String var)
Gets an attribute.
|
static TransactionImpl |
getCurrent() |
int |
getEnlistedResourceCount()
Returns the current number of resources.
|
java.lang.Object |
getResource(java.lang.Object key)
Gets a Resource from the underlying map.
|
int |
getStatus()
Returns the status of this transaction
|
int |
getTransactionTimeout()
sets the timeout for the transaction
|
Xid |
getXid() |
void |
handleAlarm(Alarm alarm)
Handles a callback from an alarm.
|
boolean |
isActive() |
boolean |
isEmpty()
Return true if the transaction has no resources.
|
boolean |
isRollbackOnly() |
void |
putResource(java.lang.Object key,
java.lang.Object resource) |
void |
putResource(java.lang.Object key,
XAResource resource)
Puts a resource into a map of resources and adds the resource to the
transaction.
|
void |
registerInterposedSynchronization(Synchronization synchronization)
Registers synchronization interposed by container resources such as the JPA
persistence provider.
|
void |
registerSynchronization(Synchronization synchronization)
Register a synchronization callback
|
void |
rollback()
Rollback the transaction.
|
void |
setAttribute(java.lang.String var,
java.lang.Object value)
Adds an attribute.
|
void |
setRollbackOnly()
Force any completion to be a roll-back.
|
void |
setRollbackOnly(java.lang.Throwable exn)
Force any completion to be a rollback.
|
void |
setTransactionTimeout(int seconds)
sets the timeout for the transaction
|
void |
setUserTransaction(UserTransactionImpl ut)
Sets the user transaction.
|
java.lang.String |
toString()
Printable version of the transaction.
|
public static TransactionImpl getCurrent()
public void setUserTransaction(UserTransactionImpl ut)
public Xid getXid()
public boolean isActive()
public void putResource(java.lang.Object key, XAResource resource) throws RollbackException, SystemException
key
- User defined key for the Resource.resource
- The Resource to enlist in the transaction.RollbackException
- If a roll-back occurs.SystemException
- If an unexpected problem occurs.public void putResource(java.lang.Object key, java.lang.Object resource)
public java.lang.Object getResource(java.lang.Object key)
key
- User defined key for the resource.public boolean enlistResource(XAResource resource) throws RollbackException, SystemException
enlistResource
in interface Transaction
RollbackException
SystemException
public boolean delistResource(XAResource resource, int flag) throws SystemException
delistResource
in interface Transaction
resource
- the resource to delistflag
- XXX: ???SystemException
public int getEnlistedResourceCount()
public boolean isEmpty()
public boolean allowLocalTransactionOptimization()
public void setTransactionTimeout(int seconds) throws SystemException
SystemException
public int getTransactionTimeout() throws SystemException
SystemException
public void setAttribute(java.lang.String var, java.lang.Object value)
public java.lang.Object getAttribute(java.lang.String var)
public void registerInterposedSynchronization(Synchronization synchronization)
synchronization
- Interposed synchronization.public void registerSynchronization(Synchronization synchronization)
registerSynchronization
in interface Transaction
public int getStatus()
getStatus
in interface Transaction
public void setRollbackOnly() throws SystemException
setRollbackOnly
in interface Transaction
SystemException
public void setRollbackOnly(java.lang.Throwable exn)
public boolean isRollbackOnly()
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException
commit
in interface Transaction
RollbackException
HeuristicMixedException
HeuristicRollbackException
SystemException
public void rollback()
rollback
in interface Transaction
public void handleAlarm(Alarm alarm)
AlarmListener
handleAlarm
in interface AlarmListener
public void close()
public java.lang.String toString()
toString
in class java.lang.Object