Package org.wildfly.transaction.client
Class LocalTransaction
- java.lang.Object
-
- org.wildfly.transaction.client.AbstractTransaction
-
- org.wildfly.transaction.client.LocalTransaction
-
- All Implemented Interfaces:
jakarta.transaction.Transaction
public final class LocalTransaction extends AbstractTransaction
A transaction from a local transaction provider.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit()booleandelistResource(XAResource xaRes, int flag)booleanenlistResource(XAResource xaRes)booleanequals(Object obj)StringgetParentName()Get the name of the node which initiated the transaction.<T> TgetProviderInterface(Class<T> providerInterfaceType)Get a provider-specific interface from this transaction.ObjectgetResource(Object key)intgetStatus()intgetTransactionTimeout()Get the transaction timeout that was in force when the transaction began.XidgetXid()Get the XID of the local transaction.inthashCode()booleanisImported()Determine if this transaction was imported.voidputResource(Object key, Object value)ObjectputResourceIfAbsent(Object key, Object value)voidregisterSynchronization(jakarta.transaction.Synchronization sync)voidrollback()voidsetRollbackOnly()StringtoString()-
Methods inherited from class org.wildfly.transaction.client.AbstractTransaction
getEstimatedRemainingTime, performAction, performConsumer, performConsumer, performConsumer, performFunction, performFunction, performSupplier, performToIntFunction, performToIntFunction, registerAssociationListener
-
-
-
-
Method Detail
-
commit
public void commit() throws jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException- Specified by:
commitin interfacejakarta.transaction.Transaction- Specified by:
commitin classAbstractTransaction- Throws:
jakarta.transaction.RollbackExceptionjakarta.transaction.HeuristicMixedExceptionjakarta.transaction.HeuristicRollbackExceptionSecurityExceptionjakarta.transaction.SystemException
-
rollback
public void rollback() throws IllegalStateException, jakarta.transaction.SystemException- Specified by:
rollbackin interfacejakarta.transaction.Transaction- Specified by:
rollbackin classAbstractTransaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, jakarta.transaction.SystemException- Specified by:
setRollbackOnlyin interfacejakarta.transaction.Transaction- Overrides:
setRollbackOnlyin classAbstractTransaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
getStatus
public int getStatus() throws jakarta.transaction.SystemException- Throws:
jakarta.transaction.SystemException
-
getTransactionTimeout
public int getTransactionTimeout()
Description copied from class:AbstractTransactionGet the transaction timeout that was in force when the transaction began.- Specified by:
getTransactionTimeoutin classAbstractTransaction- Returns:
- the transaction timeout
-
enlistResource
public boolean enlistResource(XAResource xaRes) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException
- Throws:
jakarta.transaction.RollbackExceptionIllegalStateExceptionjakarta.transaction.SystemException
-
delistResource
public boolean delistResource(XAResource xaRes, int flag) throws IllegalStateException, jakarta.transaction.SystemException
- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
registerSynchronization
public void registerSynchronization(jakarta.transaction.Synchronization sync) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException- Throws:
jakarta.transaction.RollbackExceptionIllegalStateExceptionjakarta.transaction.SystemException
-
getParentName
public String getParentName()
Get the name of the node which initiated the transaction.- Returns:
- the name of the node which initiated the transaction, or
nullif it could not be determined
-
getXid
public Xid getXid()
Get the XID of the local transaction.- Returns:
- the transaction XID (not
null)
-
getResource
public Object getResource(Object key) throws NullPointerException
- Specified by:
getResourcein classAbstractTransaction- Throws:
NullPointerException
-
putResource
public void putResource(Object key, Object value) throws NullPointerException
- Specified by:
putResourcein classAbstractTransaction- Throws:
NullPointerException
-
putResourceIfAbsent
public Object putResourceIfAbsent(Object key, Object value) throws IllegalArgumentException
- Specified by:
putResourceIfAbsentin classAbstractTransaction- Throws:
IllegalArgumentException
-
isImported
public boolean isImported()
Determine if this transaction was imported.- Returns:
trueif the transaction was imported,falseif it was initiated locally
-
getProviderInterface
public <T> T getProviderInterface(Class<T> providerInterfaceType)
Description copied from class:AbstractTransactionGet a provider-specific interface from this transaction.- Overrides:
getProviderInterfacein classAbstractTransaction- Type Parameters:
T- the provider interface type- Parameters:
providerInterfaceType- the provider interface type class (must not benull)- Returns:
- the provider interface, or
nullif the given type isn't supported by this transaction's provider
-
-