public final class Transactionals extends Object
Transactional| Modifier and Type | Method and Description |
|---|---|
static <V> V |
execute(Transactional transactional,
int timeout,
TxCallable<V> callable)
Executes the given
TxCallable using the given Transactional with a given
timeout in seconds. |
static <V> V |
execute(Transactional transactional,
TxCallable<V> callable)
Executes the given
TxCallable using the given Transactional. |
static <V,X extends Throwable> |
execute(Transactional transactional,
TxCallable<V> callable,
Class<X> exception)
Executes the given
TxCallable using the given Transactional. |
static <V,X1 extends Throwable,X2 extends Throwable> |
execute(Transactional transactional,
TxCallable<V> callable,
Class<X1> exception1,
Class<X2> exception2)
Executes the given
TxCallable using the given Transactional. |
static void |
execute(Transactional transactional,
TxRunnable runnable)
Executes the given
TxRunnable using the given Transactional. |
static <X extends Throwable> |
execute(Transactional transactional,
TxRunnable runnable,
Class<X> exception)
Executes the given
TxRunnable using the given Transactional. |
static <X1 extends Throwable,X2 extends Throwable> |
execute(Transactional transactional,
TxRunnable runnable,
Class<X1> exception1,
Class<X2> exception2)
Executes the given
TxRunnable using the given Transactional. |
static <X extends Throwable> |
propagate(org.apache.tephra.TransactionFailureException e,
Class<X> propagateType)
Propagates the given
TransactionFailureException. |
static <X1 extends Throwable,X2 extends Throwable> |
propagate(org.apache.tephra.TransactionFailureException e,
Class<X1> propagateType1,
Class<X2> propagateType2)
Propagates the given
TransactionFailureException. |
public static void execute(Transactional transactional, TxRunnable runnable)
TxRunnable using the given Transactional.transactional - the Transactional to use for transactional execution.runnable - the TxRunnable to be executed inside a transactionRuntimeException - if failed to execute the given TxRunnable in a
transaction. If the TransactionFailureException has a cause in it, the cause is
propagated.public static <X extends Throwable> void execute(Transactional transactional, TxRunnable runnable, Class<X> exception) throws X extends Throwable
TxRunnable using the given Transactional.X - exception type of propagate typetransactional - the Transactional to use for transactional execution.runnable - the TxRunnable to be executed inside a transactionX - if failed to execute the given TxRunnable in a transaction. If the
TransactionFailureException has a cause in it, the cause is thrown as-is if it is an
instance of X.RuntimeException - if cause is not an instance of X. The cause is wrapped with RuntimeException if it is not already a RuntimeException.X extends Throwablepublic static <X1 extends Throwable,X2 extends Throwable> void execute(Transactional transactional, TxRunnable runnable, Class<X1> exception1, Class<X2> exception2) throws X1 extends Throwable, X2 extends Throwable
TxRunnable using the given Transactional.X1 - exception type of first propagate typeX2 - exception type of second propagate typetransactional - the Transactional to use for transactional execution.runnable - the TxRunnable to be executed inside a transactionX1 - if failed to execute the given TxRunnable in a transaction. If the
TransactionFailureException has a cause in it, the cause is thrown as-is if it is an
instance of X1.X2 - if failed to execute the given TxRunnable in a transaction. If the
TransactionFailureException has a cause in it, the cause is thrown as-is if it is an
instance of X2.RuntimeException - if cause is not an instance of X1 or X2. The cause is wrapped with
RuntimeException if it is not already a RuntimeException.X1 extends Throwablepublic static <V> V execute(Transactional transactional, TxCallable<V> callable)
TxCallable using the given Transactional.V - type of the resulttransactional - the Transactional to use for transactional execution.callable - the TxCallable to be executed inside a transactionTxCallable.RuntimeException - if failed to execute the given TxRunnable in a
transaction. If the TransactionFailureException has a cause in it, the cause is
propagated.public static <V> V execute(Transactional transactional, int timeout, TxCallable<V> callable)
TxCallable using the given Transactional with a given
timeout in seconds.V - type of the resulttransactional - the Transactional to use for transactional execution.timeout - the timeout in seconds for transactional executioncallable - the TxCallable to be executed inside a transactionTxCallable.RuntimeException - if failed to execute the given TxRunnable in a
transaction. If the TransactionFailureException has a cause in it, the cause is
propagated.public static <V,X extends Throwable> V execute(Transactional transactional, TxCallable<V> callable, Class<X> exception) throws X extends Throwable
TxCallable using the given Transactional.V - type of the resultX - exception type of propagate typetransactional - the Transactional to use for transactional execution.callable - the TxCallable to be executed inside a transactionTxCallable.X - if failed to execute the given TxRunnable in a transaction. If the
TransactionFailureException has a cause in it, the cause is thrown as-is if it is an
instance of X.RuntimeException - if cause is not an instance of X. The cause is wrapped with RuntimeException if it is not already a RuntimeException.X extends Throwablepublic static <V,X1 extends Throwable,X2 extends Throwable> V execute(Transactional transactional, TxCallable<V> callable, Class<X1> exception1, Class<X2> exception2) throws X1 extends Throwable, X2 extends Throwable
TxCallable using the given Transactional.V - type of the resultX1 - exception type of first propagate typeX2 - exception type of second propagate typetransactional - the Transactional to use for transactional execution.callable - the TxCallable to be executed inside a transactionTxCallable.X1 - if failed to execute the given TxRunnable in a transaction. If the
TransactionFailureException has a cause in it, the cause is thrown as-is if it is an
instance of X1.X2 - if failed to execute the given TxRunnable in a transaction. If the
TransactionFailureException has a cause in it, the cause is thrown as-is if it is an
instance of X2.RuntimeException - if cause is not an instance of X1 or X2. The cause is wrapped with
RuntimeException if it is not already a RuntimeException.X1 extends Throwablepublic static <X extends Throwable> X propagate(org.apache.tephra.TransactionFailureException e, Class<X> propagateType) throws X extends Throwable
TransactionFailureException. If the Throwable.getCause() doesn't return null, the cause will be used
instead for the propagation. This method will throw the failure exception as-is the given
propagated type if the type matches or as RuntimeException. This method will always
throw exception and the returned exception is for satisfying Java static analysis only.X - exception type of propagate typee - the TransactionFailureException to propagatepropagateType - if the exception is an instance of this type, it will be rethrown as
isX extends Throwablepublic static <X1 extends Throwable,X2 extends Throwable> X1 propagate(org.apache.tephra.TransactionFailureException e, Class<X1> propagateType1, Class<X2> propagateType2) throws X1 extends Throwable, X2 extends Throwable
TransactionFailureException. If the Throwable.getCause() doesn't return null, the cause will be used
instead for the propagation. This method will throw the failure exception as-is the given
propagated types if the type matches or as RuntimeException. This method will always
throw and the returned exception is for satisfying Java static analysis only.X1 - exception type of first propagate typeX2 - exception type of second propagate typee - the TransactionFailureException to propagatepropagateType1 - if the exception is an instance of this type, it will be rethrown as
ispropagateType2 - if the exception is an instance of this type, it will be rethrown as
isX1 extends ThrowableCopyright © 2024 Cask Data, Inc. Licensed under the Apache License, Version 2.0.