Package org.wildfly.transaction.client
Class RemoteTransaction
- java.lang.Object
-
- org.wildfly.transaction.client.AbstractTransaction
-
- org.wildfly.transaction.client.RemoteTransaction
-
- All Implemented Interfaces:
Transaction
public final class RemoteTransaction extends AbstractTransaction
- 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)URIgetLocation()Get the location of this remote 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.inthashCode()voidputResource(Object key, Object value)ObjectputResourceIfAbsent(Object key, Object value)voidregisterSynchronization(Synchronization sync)voidrollback()voidsetLocation(URI location)Attempt to set the location of this transaction, binding it to a remote transport provider.voidsetRollbackOnly()StringtoString()booleantryClearLocation()Attempt 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 Detail
-
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
-
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
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
-
commit
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException- Specified by:
commitin interfaceTransaction- Specified by:
commitin classAbstractTransaction- Throws:
RollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionSystemException
-
rollback
public void rollback() throws IllegalStateException, SystemException- Specified by:
rollbackin interfaceTransaction- Specified by:
rollbackin classAbstractTransaction- Throws:
IllegalStateExceptionSystemException
-
setRollbackOnly
public void setRollbackOnly() throws IllegalStateException, SystemException- Specified by:
setRollbackOnlyin interfaceTransaction- Overrides:
setRollbackOnlyin classAbstractTransaction- Throws:
IllegalStateExceptionSystemException
-
getStatus
public int getStatus()
-
enlistResource
public boolean enlistResource(XAResource xaRes)
-
delistResource
public boolean delistResource(XAResource xaRes, int flag)
-
registerSynchronization
public void registerSynchronization(Synchronization sync) throws RollbackException, IllegalStateException, SystemException
-
getLocation
public URI 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, 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 locationSystemException- 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
-
-