Public Member Functions | |
TransactionRunner (Environment env) | |
TransactionRunner (Environment env, int maxRetries, TransactionConfig config) | |
int | getMaxRetries () |
void | setMaxRetries (int maxRetries) |
boolean | getAllowNestedTransactions () |
void | setAllowNestedTransactions (boolean allowNestedTxn) |
TransactionConfig | getTransactionConfig () |
void | setTransactionConfig (TransactionConfig config) |
void | run (TransactionWorker worker) throws DatabaseException, Exception |
Static Public Attributes | |
static final int | DEFAULT_MAX_RETRIES = 10 |
A single TransactionRunner instance may be used by any number of threads for any number of transactions.
The behavior of the run() method depends on whether the environment is transactional, whether nested transactions are enabled, and whether a transaction is already active.
In a transactional environment, the rules described above support nested calls to the run() method and guarantee that the outermost call will cause the transaction to be committed or aborted. This is true whether or not nested transactions are supported or enabled. Note that nested transactions are provided as an optimization for improving concurrency but do not change the meaning of the outermost transaction. Nested transactions are not currently supported by the JE product.
Definition at line 75 of file TransactionRunner.java.
|
Creates a transaction runner for a given Berkeley DB environment. The default maximum number of retries (DEFAULT_MAX_RETRIES) and a null (default) TransactionConfig will be used.
Definition at line 93 of file TransactionRunner.java. References DEFAULT_MAX_RETRIES. |
|
Creates a transaction runner for a given Berkeley DB environment and with a given number of maximum retries.
Definition at line 112 of file TransactionRunner.java. |
|
Returns whether nested transactions will be created if Note that this method always returns false in the JE product, since nested transactions are not supported by JE. Definition at line 149 of file TransactionRunner.java. |
|
Returns the maximum number of retries that will be performed when deadlocks are detected. Definition at line 125 of file TransactionRunner.java. |
|
Returns the transaction configuration used for calling Environment#beginTransaction. If this property is null, the default configuration is used. The configuration object is not cloned, and any modifications to it will impact subsequent transactions.
Definition at line 182 of file TransactionRunner.java. |
|
Calls the TransactionWorker#doWork method and, for transactional environments, may begin and end a transaction. If the environment given is non-transactional, a transaction will not be used but the doWork() method will still be called. See the class description for more information.
Definition at line 218 of file TransactionRunner.java. References com::sleepycat::collections::CurrentTransaction::abortTransaction(), com::sleepycat::collections::CurrentTransaction::beginTransaction(), com::sleepycat::collections::CurrentTransaction::commitTransaction(), and com::sleepycat::collections::CurrentTransaction::getTransaction(). Referenced by collections::hello::HelloDatabaseWorld::main(), and collections::access::AccessExample::run(). |
|
Changes whether nested transactions will be created if Note that true may not be passed to this method in the JE product, since nested transactions are not supported by JE. Definition at line 163 of file TransactionRunner.java. |
|
Changes the maximum number of retries that will be performed when deadlocks are detected. Calling this method does not impact transactions already running. Definition at line 135 of file TransactionRunner.java. |
|
Changes the transaction configuration used for calling Environment#beginTransaction. If this property is null, the default configuration is used. The configuration object is not cloned, and any modifications to it will impact subsequent transactions.
Definition at line 197 of file TransactionRunner.java. |
|
The default maximum number of retries. Definition at line 78 of file TransactionRunner.java. Referenced by TransactionRunner(). |