Package com.yahoo.transaction
Class AbstractTransaction
java.lang.Object
com.yahoo.transaction.AbstractTransaction
- All Implemented Interfaces:
Transaction,AutoCloseable
A convenience base transaction class for multi-operation transactions
which maintains the ordered list of operations to commit and provides a default
implementation of rollbackOrLog which logs a SEVERE message.
- Author:
- bratseth
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.yahoo.transaction.Transaction
Transaction.Operation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Transaction.Operation operation) Adds an operation to this transaction.add(List<Transaction.Operation> operations) Adds multiple operations to this transaction.voidclose()Default implementation which only clears operationsReturns the operations of this.voidDefault implementations which logs a severe message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yahoo.transaction.Transaction
commit, prepare
-
Constructor Details
-
AbstractTransaction
protected AbstractTransaction()
-
-
Method Details
-
add
Description copied from interface:TransactionAdds an operation to this transaction. Return self for chaining.- Specified by:
addin interfaceTransaction- Parameters:
operation-Transaction.Operationto append- Returns:
- self, for chaining
-
add
Description copied from interface:TransactionAdds multiple operations to this transaction. Return self for chaining.- Specified by:
addin interfaceTransaction- Parameters:
operations-Transaction.Operationto append- Returns:
- self, for chaining
-
operations
Description copied from interface:TransactionReturns the operations of this. Ownership of the returned list is transferred to the caller. The ist may be ready only.- Specified by:
operationsin interfaceTransaction
-
rollbackOrLog
public void rollbackOrLog()Default implementations which logs a severe message. Operations should implement toString to use this.- Specified by:
rollbackOrLogin interfaceTransaction
-
close
public void close()Default implementation which only clears operations- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTransaction
-