|
Berkeley DB Java Edition version 5.0.34 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.collections.CurrentTransaction
public class CurrentTransaction
Provides access to the current transaction for the current thread within the
context of a Berkeley DB environment. This class provides explicit
transaction control beyond that provided by the TransactionRunner
class. However, both methods of transaction control manage per-thread
transactions.
Method Summary | |
---|---|
Transaction |
abortTransaction()
Aborts the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction. |
Transaction |
beginTransaction(TransactionConfig config)
Begins a new transaction for this environment and associates it with the current thread. |
Transaction |
commitTransaction()
Commits the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction. |
Environment |
getEnvironment()
Returns the underlying Berkeley DB environment. |
static CurrentTransaction |
getInstance(Environment env)
Gets the CurrentTransaction accessor for a specified Berkeley DB environment. |
Transaction |
getTransaction()
Returns the transaction associated with the current thread for this environment, or null if no transaction is active. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static CurrentTransaction getInstance(Environment env)
env
- is an open Berkeley DB environment.
public final Environment getEnvironment()
public final Transaction getTransaction()
public final Transaction beginTransaction(TransactionConfig config) throws DatabaseException
config
- the transaction configuration used for calling
Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.TransactionConfig)
, or null to use the default
configuration.
InsufficientReplicasException
- if the Master
in a replicated environment could not contact a quorum of replicas as
determined by the Durability.ReplicaAckPolicy
.
ReplicaConsistencyException
- if a replica
in a replicated environment cannot become consistent within the timeout
period.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- if the transaction cannot be started, in which
case any existing transaction is not affected.
IllegalStateException
- if a transaction is already active and
nested transactions are not supported by the environment.public final Transaction commitTransaction() throws DatabaseException, IllegalStateException
InsufficientReplicasException
- if the master
in a replicated environment could not contact a quorum of replicas as
determined by the Durability.ReplicaAckPolicy
.
The application must abort the transaction and can choose to retry it.
InsufficientAcksException
- if the master in
a replicated environment did not receive enough replica acknowledgments,
although the commit succeeded locally.
ReplicaWriteException
- if a write operation
was performed with this transaction, but this node is now a Replica.
OperationFailureException
- if this exception occurred earlier and
caused the transaction to be invalidated.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- if an error occurs committing the transaction.
The transaction will still be closed and the parent transaction will
become the current transaction.
IllegalStateException
- if no transaction is active for the
current thread for this environment.public final Transaction abortTransaction() throws DatabaseException, IllegalStateException
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- if an error occurs aborting the transaction.
The transaction will still be closed and the parent transaction will
become the current transaction.
IllegalStateException
- if no transaction is active for the
current thread for this environment.
|
Berkeley DB Java Edition version 5.0.34 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |