Package org.wildfly.transaction.client
Class AbstractTransaction
java.lang.Object
org.wildfly.transaction.client.AbstractTransaction
- All Implemented Interfaces:
Transaction
- Direct Known Subclasses:
LocalTransaction,RemoteTransaction
A managed transaction.
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionabstract voidcommit()final intGet an estimate of the amount of time remaining in this transaction.<T> TgetProviderInterface(Class<T> providerInterfaceType) Get a provider-specific interface from this transaction.abstract ObjectgetResource(Object key) abstract intGet the transaction timeout that was in force when the transaction began.<E extends Exception>
voidperformAction(org.wildfly.common.function.ExceptionRunnable<E> action) <T,U, E extends Exception>
voidperformConsumer(org.wildfly.common.function.ExceptionBiConsumer<T, U, E> consumer, T param1, U param2) <T,E extends Exception>
voidperformConsumer(org.wildfly.common.function.ExceptionConsumer<T, E> consumer, T param) <T,E extends Exception>
voidperformConsumer(org.wildfly.common.function.ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) <T,U, R, E extends Exception>
RperformFunction(org.wildfly.common.function.ExceptionBiFunction<T, U, R, E> function, T param1, U param2) <T,R, E extends Exception>
RperformFunction(org.wildfly.common.function.ExceptionFunction<T, R, E> function, T param) <R,E extends Exception>
RperformSupplier(org.wildfly.common.function.ExceptionSupplier<R, E> function) <T,U, E extends Exception>
intperformToIntFunction(org.wildfly.common.function.ExceptionToIntBiFunction<T, U, E> function, T param1, U param2) <T,E extends Exception>
intperformToIntFunction(org.wildfly.common.function.ExceptionToIntFunction<T, E> function, T param) abstract voidputResource(Object key, Object value) abstract ObjectputResourceIfAbsent(Object key, Object value) voidregisterAssociationListener(AssociationListener associationListener) Register an association listener for this transaction, which will be called any time this thread is suspended or resumed.abstract voidrollback()voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.transaction.Transaction
delistResource, enlistResource, getStatus, registerSynchronization
-
Method Details
-
getResource
- Throws:
NullPointerException
-
putResource
- Throws:
NullPointerException
-
putResourceIfAbsent
public abstract Object putResourceIfAbsent(Object key, Object value) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
setRollbackOnly
- Specified by:
setRollbackOnlyin interfaceTransaction- Throws:
IllegalStateExceptionSystemException
-
getTransactionTimeout
public abstract int getTransactionTimeout()Get the transaction timeout that was in force when the transaction began.- Returns:
- the transaction timeout
-
getEstimatedRemainingTime
public final int getEstimatedRemainingTime()Get an estimate of the amount of time remaining in this transaction.- Returns:
- the estimate in seconds, or 0 if the transaction is estimated to have expired
-
getProviderInterface
Get a provider-specific interface from this transaction.- 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
-
registerAssociationListener
Register an association listener for this transaction, which will be called any time this thread is suspended or resumed.- Parameters:
associationListener- the association listener (must not benull)
-
commit
public abstract void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException- Specified by:
commitin interfaceTransaction- Throws:
RollbackExceptionHeuristicMixedExceptionHeuristicRollbackExceptionSecurityExceptionSystemException
-
rollback
- Specified by:
rollbackin interfaceTransaction- Throws:
IllegalStateExceptionSystemException
-
performFunction
public <T,U, R performFunctionR, E extends Exception> (org.wildfly.common.function.ExceptionBiFunction<T, U, throws E, SystemExceptionR, E> function, T param1, U param2) - Throws:
E extends ExceptionSystemException
-
performFunction
public <T,R, R performFunctionE extends Exception> (org.wildfly.common.function.ExceptionFunction<T, R, throws E, SystemExceptionE> function, T param) - Throws:
E extends ExceptionSystemException
-
performSupplier
public <R,E extends Exception> R performSupplier(org.wildfly.common.function.ExceptionSupplier<R, E> function) throws E, SystemException- Throws:
E extends ExceptionSystemException
-
performConsumer
public <T,E extends Exception> void performConsumer(org.wildfly.common.function.ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, SystemException- Throws:
E extends ExceptionSystemException
-
performConsumer
public <T,U, void performConsumerE extends Exception> (org.wildfly.common.function.ExceptionBiConsumer<T, U, throws E, SystemExceptionE> consumer, T param1, U param2) - Throws:
E extends ExceptionSystemException
-
performConsumer
public <T,E extends Exception> void performConsumer(org.wildfly.common.function.ExceptionConsumer<T, E> consumer, T param) throws E, SystemException- Throws:
E extends ExceptionSystemException
-
performToIntFunction
public <T,U, int performToIntFunctionE extends Exception> (org.wildfly.common.function.ExceptionToIntBiFunction<T, U, throws E, SystemExceptionE> function, T param1, U param2) - Throws:
E extends ExceptionSystemException
-
performToIntFunction
public <T,E extends Exception> int performToIntFunction(org.wildfly.common.function.ExceptionToIntFunction<T, E> function, T param) throws E, SystemException- Throws:
E extends ExceptionSystemException
-
performAction
public <E extends Exception> void performAction(org.wildfly.common.function.ExceptionRunnable<E> action) throws E, SystemException - Throws:
E extends ExceptionSystemException
-