-
public interface TransactionCompletion
A mutable object that controls whether a transactionCompletionOperation
sends a database commit or a database rollback to the server. A transactionCompletionOperation
is created with aTransactionCompletion
. By default a transactionCompletionOperation
requests that the database end the transaction with a commit. IfsetRollbackOnly()
is called on theTransactionCompletion
used to create the Operation prior to the Operation being executed, the Operation will request that the database end the transaction with a rollback. Example:TransactionCompletion t = session.transactionCompletion(); session.countOperation(updateSql) .resultProcessor( count -> { if (count > 1) t.setRollbackOnly(); } ) .submit(); session.commitMaybeRollback(t);
TransactionCompletion
can not be used to create more than one endTransactionOperation
. ATransactionCompletion
is thread safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isRollbackOnly()
Returnstrue
iff thesetRollbackOnly()
method has been called on this TransactionCompletionboolean
setRollbackOnly()
Causes an endTransactionOperation
created with thisTransactionCompletion
that is executed subsequent to this call to perform a rollback.
-
-
-
Method Detail
-
setRollbackOnly
boolean setRollbackOnly()
Causes an endTransactionOperation
created with thisTransactionCompletion
that is executed subsequent to this call to perform a rollback. If this method is not called prior toOperation
execution theOperation
will perform a commit.- Returns:
true
if the call succeeded.false
if the call did not succeed in setting the TransactionCompletion rollback only because the endTransaction Operation had already been executed.
-
isRollbackOnly
boolean isRollbackOnly()
Returnstrue
iff thesetRollbackOnly()
method has been called on this TransactionCompletion- Returns:
true
ifsetRollbackOnly()
has been called.
-
-