public class DefaultTransactionExecutor extends AbstractTransactionExecutor
Transaction execution will be retries according to specified in constructor RetryStrategy
.
By default RetryOnConflictStrategy
is used with max 20 retries and 100 ms between retries.
TransactionExecutor.Function<I,O>, TransactionExecutor.Procedure<I>, TransactionExecutor.Subroutine
Constructor and Description |
---|
DefaultTransactionExecutor(TransactionSystemClient txClient,
Iterable<TransactionAware> txAwares)
Constructor for a transaction executor.
|
DefaultTransactionExecutor(TransactionSystemClient txClient,
Iterable<TransactionAware> txAwares,
RetryStrategy retryStrategy) |
DefaultTransactionExecutor(TransactionSystemClient txClient,
TransactionAware... txAwares)
Convenience constructor, has same affect as
DefaultTransactionExecutor(TransactionSystemClient, Iterable) |
Modifier and Type | Method and Description |
---|---|
<O> O |
execute(Callable<O> callable)
Like
TransactionExecutor.execute(Function, Object) but the callable has no argument. |
<I,O> O |
execute(TransactionExecutor.Function<I,O> function,
I input)
Execute a function under transactional semantics.
|
<I> void |
execute(TransactionExecutor.Procedure<I> procedure,
I input)
Like
TransactionExecutor.execute(Function, Object) but without a return value. |
void |
execute(TransactionExecutor.Subroutine subroutine)
Like
TransactionExecutor.execute(Function, Object) but without argument or return value. |
executeUnchecked, executeUnchecked, executeUnchecked, executeUnchecked, submit, submit, submit, submit
public DefaultTransactionExecutor(TransactionSystemClient txClient, TransactionAware... txAwares)
DefaultTransactionExecutor(TransactionSystemClient, Iterable)
public DefaultTransactionExecutor(TransactionSystemClient txClient, Iterable<TransactionAware> txAwares, RetryStrategy retryStrategy)
@Inject public DefaultTransactionExecutor(TransactionSystemClient txClient, Iterable<TransactionAware> txAwares)
public <I,O> O execute(TransactionExecutor.Function<I,O> function, I input) throws TransactionFailureException, InterruptedException
TransactionExecutor
I
- the input type of the functionO
- the result type of the functionfunction
- the function to executeinput
- the input parameter for the functionTransactionConflictException
- if there is a write conflict with another transaction.TransactionFailureException
- if any exception is caught, be it from the function or from the datasets.InterruptedException
public <I> void execute(TransactionExecutor.Procedure<I> procedure, I input) throws TransactionFailureException, InterruptedException
TransactionExecutor
TransactionExecutor.execute(Function, Object)
but without a return value.public <O> O execute(Callable<O> callable) throws TransactionFailureException, InterruptedException
TransactionExecutor
TransactionExecutor.execute(Function, Object)
but the callable has no argument.public void execute(TransactionExecutor.Subroutine subroutine) throws TransactionFailureException, InterruptedException
TransactionExecutor
TransactionExecutor.execute(Function, Object)
but without argument or return value.Copyright © 2016 The Apache Software Foundation. All rights reserved.