public interface TwoPhaseCommitTransactionManager extends TransactionManagerCrudOperable, java.lang.AutoCloseable
Just like a well-known two-phase commit protocol, there are two roles, a coordinator and a
participant, that execute a single transaction collaboratively. A coordinator process first
starts a transaction with start() or start(String), and participant processes
join the transaction with join(String) with the transaction ID. Also, participants can
resume the transaction with resume(String) with the transaction ID.
| Modifier and Type | Method and Description |
|---|---|
default TransactionState |
abort(java.lang.String txId)
Aborts a given transaction.
|
TwoPhaseCommitTransaction |
begin()
Begins a new transaction.
|
TwoPhaseCommitTransaction |
begin(java.lang.String txId)
Begins a new transaction with the specified transaction ID.
|
void |
close()
Closes connections to the cluster.
|
java.util.Optional<java.lang.String> |
getNamespace()
Deprecated.
As of release 3.6.0. Will be removed in release 5.0.0
|
TransactionState |
getState(java.lang.String txId)
Returns the state of a given transaction.
|
java.util.Optional<java.lang.String> |
getTable()
Deprecated.
As of release 3.6.0. Will be removed in release 5.0.0
|
TwoPhaseCommitTransaction |
join(java.lang.String txId)
Joins a transaction associated with the specified transaction ID.
|
TwoPhaseCommitTransaction |
resume(java.lang.String txId)
Resumes an ongoing transaction associated with the specified transaction ID.
|
TransactionState |
rollback(java.lang.String txId)
Rolls back a given transaction.
|
default TwoPhaseCommitTransaction |
start()
Starts a new transaction.
|
default TwoPhaseCommitTransaction |
start(java.lang.String txId)
Starts a new transaction with the specified transaction ID.
|
void |
with(java.lang.String namespace,
java.lang.String tableName)
Deprecated.
As of release 3.6.0. Will be removed in release 5.0.0
|
void |
withNamespace(java.lang.String namespace)
Deprecated.
As of release 3.6.0. Will be removed in release 5.0.0
|
void |
withTable(java.lang.String tableName)
Deprecated.
As of release 3.6.0. Will be removed in release 5.0.0
|
@Deprecated
void with(java.lang.String namespace,
java.lang.String tableName)
namespace - default namespace to operate fortableName - default table name to operate for@Deprecated void withNamespace(java.lang.String namespace)
namespace - default namespace to operate for@Deprecated java.util.Optional<java.lang.String> getNamespace()
Optional with the namespace@Deprecated void withTable(java.lang.String tableName)
tableName - default table name to operate for@Deprecated java.util.Optional<java.lang.String> getTable()
Optional with the table nameTwoPhaseCommitTransaction begin() throws TransactionNotFoundException, TransactionException
DistributedTransactionTransactionNotFoundException - if the transaction fails to begin due to transient faults.
You can retry the transactionTransactionException - if the transaction fails to begin due to transient or nontransient
faults. You can try retrying the transaction, but you may not be able to begin the
transaction due to nontransient faultsTwoPhaseCommitTransaction begin(java.lang.String txId) throws TransactionNotFoundException, TransactionException
txId - an user-provided unique transaction IDDistributedTransactionTransactionNotFoundException - if the transaction fails to begin due to transient faults.
You can retry the transactionTransactionException - if the transaction fails to begin due to transient or nontransient
faults. You can try retrying the transaction, but you may not be able to begin the
transaction due to nontransient faultsdefault TwoPhaseCommitTransaction start() throws TransactionNotFoundException, TransactionException
begin().DistributedTransactionTransactionNotFoundException - if the transaction fails to start due to transient faults.
You can retry the transactionTransactionException - if the transaction fails to start due to transient or nontransient
faults. You can try retrying the transaction, but you may not be able to start the
transaction due to nontransient faultsdefault TwoPhaseCommitTransaction start(java.lang.String txId) throws TransactionNotFoundException, TransactionException
begin(String).txId - an user-provided unique transaction IDDistributedTransactionTransactionNotFoundException - if the transaction fails to start due to transient faults.
You can retry the transactionTransactionException - if the transaction fails to start due to transient or nontransient
faults. You can try retrying the transaction, but you may not be able to start the
transaction due to nontransient faultsTwoPhaseCommitTransaction join(java.lang.String txId) throws TransactionNotFoundException, TransactionException
txId - the transaction IDTwoPhaseCommitTransactionTransactionNotFoundException - if joining the transaction fails due to transient faults.
You can retry the transaction from the beginningTransactionException - if joining the transaction fails due to transient or nontransient
faults. You can try retrying the transaction from the beginning, but the transaction may
still fail if the cause is nontranientTwoPhaseCommitTransaction resume(java.lang.String txId) throws TransactionNotFoundException
txId - the transaction IDTwoPhaseCommitTransactionTransactionNotFoundException - if the transaction associated with the specified
transaction ID is not found. You can retry the transaction from the beginningTransactionState getState(java.lang.String txId) throws TransactionException
txId - a transaction IDTransactionStateTransactionException - if getting the state of a given transaction failsTransactionState rollback(java.lang.String txId) throws TransactionException
txId - a transaction IDTransactionStateTransactionException - if rolling back the given transaction failsdefault TransactionState abort(java.lang.String txId) throws TransactionException
rollback(String).txId - a transaction IDTransactionStateTransactionException - if aborting the given transaction failsvoid close()
close in interface java.lang.AutoCloseable