Package org.wildfly.transaction.client
Class AbstractTransaction
java.lang.Object
org.wildfly.transaction.client.AbstractTransaction
- All Implemented Interfaces:
jakarta.transaction.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 jakarta.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 interfacejakarta.transaction.Transaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
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 jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException, SecurityException, jakarta.transaction.SystemException- Specified by:
commitin interfacejakarta.transaction.Transaction- Throws:
jakarta.transaction.RollbackExceptionjakarta.transaction.HeuristicMixedExceptionjakarta.transaction.HeuristicRollbackExceptionSecurityExceptionjakarta.transaction.SystemException
-
rollback
- Specified by:
rollbackin interfacejakarta.transaction.Transaction- Throws:
IllegalStateExceptionjakarta.transaction.SystemException
-
performFunction
public <T,U, R performFunctionR, E extends Exception> (org.wildfly.common.function.ExceptionBiFunction<T, U, throws E, jakarta.transaction.SystemExceptionR, E> function, T param1, U param2) - Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performFunction
public <T,R, R performFunctionE extends Exception> (org.wildfly.common.function.ExceptionFunction<T, R, throws E, jakarta.transaction.SystemExceptionE> function, T param) - Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performSupplier
public <R,E extends Exception> R performSupplier(org.wildfly.common.function.ExceptionSupplier<R, E> function) throws E, jakarta.transaction.SystemException- Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performConsumer
public <T,E extends Exception> void performConsumer(org.wildfly.common.function.ExceptionObjIntConsumer<T, E> consumer, T param1, int param2) throws E, jakarta.transaction.SystemException- Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performConsumer
public <T,U, void performConsumerE extends Exception> (org.wildfly.common.function.ExceptionBiConsumer<T, U, throws E, jakarta.transaction.SystemExceptionE> consumer, T param1, U param2) - Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performConsumer
public <T,E extends Exception> void performConsumer(org.wildfly.common.function.ExceptionConsumer<T, E> consumer, T param) throws E, jakarta.transaction.SystemException- Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performToIntFunction
public <T,U, int performToIntFunctionE extends Exception> (org.wildfly.common.function.ExceptionToIntBiFunction<T, U, throws E, jakarta.transaction.SystemExceptionE> function, T param1, U param2) - Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performToIntFunction
public <T,E extends Exception> int performToIntFunction(org.wildfly.common.function.ExceptionToIntFunction<T, E> function, T param) throws E, jakarta.transaction.SystemException- Throws:
E extends Exceptionjakarta.transaction.SystemException
-
performAction
public <E extends Exception> void performAction(org.wildfly.common.function.ExceptionRunnable<E> action) throws E, jakarta.transaction.SystemException - Throws:
E extends Exceptionjakarta.transaction.SystemException
-