|
Berkeley DB Java Edition Examples version 5.0.58 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectje.rep.quote.RunTransaction
public abstract class RunTransaction
Utility class to begin and commit/abort a transaction and handle exceptions according to this application's policies. The doTransactionWork method is abstract and must be implemented by callers. The transaction is run and doTransactionWork is called by the run() method of this class. The onReplicaWrite and onRetryFailure methods may optionally be overridden.
Method Summary | |
---|---|
abstract void |
doTransactionWork(Transaction txn)
Must be implemented to perform operations using the given Transaction. |
void |
onReplicaWrite(ReplicaWriteException replicaWrite)
May be optionally overridden to handle a ReplicaWriteException. |
void |
onRetryFailure(OperationFailureException lastException)
May be optionally overridden to handle a failure after the TRANSACTION_RETRY_MAX has been exceeded. |
void |
run(boolean readOnly)
Runs a transaction, calls the doTransactionWork method, and retries as needed. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void run(boolean readOnly) throws InterruptedException, EnvironmentFailureException
If the transaction is read only, it uses Durability.READ_ONLY_TXN for
the Transaction. Since this Durability policy does not call for any
acknowledgments, it eliminates the possibility of a InsufficientReplicasException
being thrown from the call to Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.TransactionConfig)
for a read only transaction on a Master,
which is an overly stringent requirement. This makes the Master more
available for read operations.
readOnly
- determines whether the transaction to be run is read
only.
InterruptedException
EnvironmentFailureException
public abstract void doTransactionWork(Transaction txn)
public void onReplicaWrite(ReplicaWriteException replicaWrite)
public void onRetryFailure(OperationFailureException lastException)
|
Berkeley DB Java Edition Examples version 5.0.58 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |