Package org.wildfly.transaction.client
Class RemoteTransaction
java.lang.Object
org.wildfly.transaction.client.AbstractTransaction
org.wildfly.transaction.client.RemoteTransaction
- All Implemented Interfaces:
jakarta.transaction.Transaction
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()booleandelistResource(XAResource xaRes, int flag) booleanenlistResource(XAResource xaRes) booleanGet the location of this remote transaction.<T> TgetProviderInterface(Class<T> providerInterfaceType) Get a provider-specific interface from this transaction.getResource(Object key) intintGet the transaction timeout that was in force when the transaction began.inthashCode()voidputResource(Object key, Object value) putResourceIfAbsent(Object key, Object value) voidregisterSynchronization(jakarta.transaction.Synchronization sync) voidrollback()voidsetLocation(URI location) Attempt to set the location of this transaction, binding it to a remote transport provider.voidtoString()booleanAttempt to clear the location set on this transaction, disassociating it with the remote transport provider.Methods inherited from class org.wildfly.transaction.client.AbstractTransaction
getEstimatedRemainingTime, performAction, performConsumer, performConsumer, performConsumer, performFunction, performFunction, performSupplier, performToIntFunction, performToIntFunction, registerAssociationListener
-
Method Details
-
getResource
- Specified by:
getResourcein classAbstractTransaction- Throws:
NullPointerException
-
putResource
- Specified by:
putResourcein classAbstractTransaction- Throws:
NullPointerException
-
putResourceIfAbsent
- Specified by:
putResourceIfAbsentin classAbstractTransaction- Throws:
IllegalArgumentException
-
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
-
getProviderInterface
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
-
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
- Specified by:
rollbackin interfacejakarta.transaction.Transaction- Specified by:
rollbackin classAbstractTransaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
setRollbackOnly
- Specified by:
setRollbackOnlyin interfacejakarta.transaction.Transaction- Overrides:
setRollbackOnlyin classAbstractTransaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
getStatus
public int getStatus() -
enlistResource
-
delistResource
-
registerSynchronization
public void registerSynchronization(jakarta.transaction.Synchronization sync) throws jakarta.transaction.RollbackException, IllegalStateException, jakarta.transaction.SystemException - Throws:
jakarta.transaction.RollbackExceptionIllegalStateExceptionjakarta.transaction.SystemException
-
hashCode
public int hashCode() -
equals
-
toString
-
getLocation
Get the location of this remote transaction.- Returns:
- the location of this remote transaction, or
nullif it has no location as of yet
-
setLocation
public void setLocation(URI location) throws IllegalArgumentException, IllegalStateException, jakarta.transaction.SystemException Attempt to set the location of this transaction, binding it to a remote transport provider.- Parameters:
location- the location to set (must not benull)- Throws:
IllegalArgumentException- if there is no provider for the given location (or it isnull), or the security context was invalidIllegalStateException- if the transaction is in an invalid state for setting its locationjakarta.transaction.SystemException- if the transport could not begin the transaction
-
tryClearLocation
public boolean tryClearLocation()Attempt to clear the location set on this transaction, disassociating it with the remote transport provider. There is only a limited time window at which this can occur, before the transaction is ever used. Typically this is only useful for retrying an initial invocation on a transaction.- Returns:
- whether the attempt was successful
-