Package org.multiverse.stms.gamma
Class GammaOrElseBlock
- java.lang.Object
-
- org.multiverse.stms.gamma.GammaOrElseBlock
-
- All Implemented Interfaces:
OrElseBlock
,MultiverseConstants
public class GammaOrElseBlock extends java.lang.Object implements OrElseBlock
-
-
Field Summary
-
Fields inherited from interface org.multiverse.MultiverseConstants
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED
-
-
Constructor Summary
Constructors Constructor Description GammaOrElseBlock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
execute(TxnBooleanCallable either, TxnBooleanCallable orelse)
Executes the either, or when it is retried, the orelse block.<E> E
execute(TxnCallable<E> either, TxnCallable<E> orelse)
Executes the either, or when it is retried, the orelse block.double
execute(TxnDoubleCallable either, TxnDoubleCallable orelse)
Executes the either, or when it is retried, the orelse block.int
execute(TxnIntCallable either, TxnIntCallable orelse)
Executes the either, or when it is retried, the orelse block.long
execute(TxnLongCallable either, TxnLongCallable orelse)
Executes the either, or when it is retried, the orelse block.void
execute(TxnVoidCallable either, TxnVoidCallable orelse)
Executes the either, or when it is retried, the orelse block.boolean
executeChecked(TxnBooleanCallable either, TxnBooleanCallable orelse)
Executes the either, or when it is retried, the orelse block.<E> E
executeChecked(TxnCallable<E> either, TxnCallable<E> orelse)
Executes the either, or when it is retried, the orelse block.double
executeChecked(TxnDoubleCallable either, TxnDoubleCallable orelse)
Executes the either, or when it is retried, the orelse block.int
executeChecked(TxnIntCallable either, TxnIntCallable orelse)
Executes the either, or when it is retried, the orelse block.long
executeChecked(TxnLongCallable either, TxnLongCallable orelse)
Executes the either, or when it is retried, the orelse block.void
executeChecked(TxnVoidCallable either, TxnVoidCallable orelse)
Executes the either, or when it is retried, the orelse block.
-
-
-
Method Detail
-
execute
public <E> E execute(TxnCallable<E> either, TxnCallable<E> orelse)
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible. If in the execution of the closure a checked exception is thrown, the exception is wrapped in a InvisibleCheckedException. The original exception can be retrieved by calling the getCause method.- Specified by:
execute
in interfaceOrElseBlock
- Returns:
- the result of the execution.
-
executeChecked
public <E> E executeChecked(TxnCallable<E> either, TxnCallable<E> orelse) throws java.lang.Exception
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible.- Specified by:
executeChecked
in interfaceOrElseBlock
- Returns:
- the result of the execution.
- Throws:
java.lang.NullPointerException
- if either or orelse is null.TxnMandatoryException
- if no transaction is found on the TxnThreadLocal.java.lang.Exception
- if the atomicChecked call fails.
-
execute
public int execute(TxnIntCallable either, TxnIntCallable orelse)
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible. If in the execution of the closure a checked exception is thrown, the exception is wrapped in a InvisibleCheckedException. The original exception can be retrieved by calling the getCause method.- Specified by:
execute
in interfaceOrElseBlock
- Returns:
- the result of the execution.
-
executeChecked
public int executeChecked(TxnIntCallable either, TxnIntCallable orelse) throws java.lang.Exception
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible.- Specified by:
executeChecked
in interfaceOrElseBlock
- Returns:
- the result of the execution.
- Throws:
java.lang.NullPointerException
- if either or orelse is null.java.lang.Exception
- if the atomicChecked call fails.
-
execute
public long execute(TxnLongCallable either, TxnLongCallable orelse)
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible. If in the execution of the closure a checked exception is thrown, the exception is wrapped in a InvisibleCheckedException. The original exception can be retrieved by calling the getCause method.- Specified by:
execute
in interfaceOrElseBlock
- Returns:
- the result of the execution.
-
executeChecked
public long executeChecked(TxnLongCallable either, TxnLongCallable orelse) throws java.lang.Exception
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible.- Specified by:
executeChecked
in interfaceOrElseBlock
- Returns:
- the result of the execution.
- Throws:
java.lang.NullPointerException
- if either or orelse is null.java.lang.Exception
- if the atomicChecked call fails.
-
execute
public double execute(TxnDoubleCallable either, TxnDoubleCallable orelse)
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible. If in the execution of the closure a checked exception is thrown, the exception is wrapped in a InvisibleCheckedException. The original exception can be retrieved by calling the getCause method.- Specified by:
execute
in interfaceOrElseBlock
- Returns:
- the result of the execution.
-
executeChecked
public double executeChecked(TxnDoubleCallable either, TxnDoubleCallable orelse) throws java.lang.Exception
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible.- Specified by:
executeChecked
in interfaceOrElseBlock
- Returns:
- the result of the execution.
- Throws:
java.lang.NullPointerException
- if either or orelse is null.java.lang.Exception
- if the atomicChecked call fails.
-
execute
public boolean execute(TxnBooleanCallable either, TxnBooleanCallable orelse)
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible. If in the execution of the closure a checked exception is thrown, the exception is wrapped in a InvisibleCheckedException. The original exception can be retrieved by calling the getCause method.- Specified by:
execute
in interfaceOrElseBlock
- Returns:
- the result of the execution.
-
executeChecked
public boolean executeChecked(TxnBooleanCallable either, TxnBooleanCallable orelse) throws java.lang.Exception
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible.- Specified by:
executeChecked
in interfaceOrElseBlock
- Returns:
- the result of the execution.
- Throws:
java.lang.NullPointerException
- if either or orelse is null.java.lang.Exception
- if the atomicChecked call fails.
-
execute
public void execute(TxnVoidCallable either, TxnVoidCallable orelse)
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible. If in the execution of the closure a checked exception is thrown, the exception is wrapped in a InvisibleCheckedException. The original exception can be retrieved by calling the getCause method.- Specified by:
execute
in interfaceOrElseBlock
-
executeChecked
public void executeChecked(TxnVoidCallable either, TxnVoidCallable orelse) throws java.lang.Exception
Description copied from interface:OrElseBlock
Executes the either, or when it is retried, the orelse block. This operation makes composable blocking operations possible.- Specified by:
executeChecked
in interfaceOrElseBlock
- Throws:
java.lang.NullPointerException
- if either or orelse is null.java.lang.Exception
- if the atomicChecked call fails.
-
-