Transaction handles are not free-threaded; transactions handles may be used by multiple threads, but only serially, that is, the application must serialize access to the handle. Once the {@link com.sleepycat.db.Transaction#abort Transaction.abort}, {@link com.sleepycat.db.Transaction#commit Transaction.commit} or{@link com.sleepycat.db.Transaction#discard Transaction.discard}methods are called, the handle may not be accessed again, regardless of the success or failure of the method. In addition, parent transactions may not issue any Berkeley DB operations while they have active child transactions (child transactions that have not yet been committed or aborted) except for {@link com.sleepycat.db.Environment#beginTransaction Environment.beginTransaction}, {@link com.sleepycat.db.Transaction#abort Transaction.abort} and {@link com.sleepycat.db.Transaction#commit Transaction.commit}.
To obtain a transaction with default attributes:
To customize the attributes of a transaction:Transaction txn = myEnvironment.beginTransaction(null, null);
TransactionConfig config = new TransactionConfig(); config.setDirtyRead(true); Transaction txn = myEnvironment.beginTransaction(null, config);
|
|
|
|