VMware GemFire Native Client C++ API Reference
|
VMware VMware GemFire Native C++ Reference 10.4.3
|
An interface for objects who perform transaction management. More...
#include <CacheTransactionManager.hpp>
Public Member Functions | |
| virtual void | begin ()=0 |
| Creates a new transaction and associates it with the current thread. | |
| virtual void | commit ()=0 |
| Commit the transaction associated with the current thread. | |
| virtual bool | exists ()=0 |
| Reports the existence of a Transaction for this thread. | |
| virtual bool | exists (TransactionId &transactionId)=0 |
| Reports the existence of a transaction for the given transactionId. | |
| virtual TransactionId & | getTransactionId ()=0 |
| Returns the transaction identifier for the current thread. | |
| virtual bool | isSuspended (TransactionId &transactionId)=0 |
| This method can be used to determine if a transaction with the given transaction identifier is currently suspended locally. | |
| virtual void | prepare ()=0 |
| Performs prepare during 2 phase commit completion, for the transaction associated with the current thread. | |
| virtual void | resume (TransactionId &transactionId)=0 |
On the current thread, resumes a transaction that was previously suspended using suspend(). | |
| virtual void | rollback ()=0 |
| Roll back the transaction associated with the current thread. | |
| virtual TransactionId & | suspend ()=0 |
| Suspends the transaction on the current thread. | |
| virtual bool | tryResume (TransactionId &transactionId)=0 |
On the current thread, resumes a transaction that was previously suspended using suspend(). | |
| virtual bool | tryResume (TransactionId &transactionId, std::chrono::milliseconds waitTime)=0 |
On the current thread, resumes a transaction that was previously suspended using suspend(), or waits for the specified timeout interval if the transaction has not been suspended. | |
Detailed Description
An interface for objects who perform transaction management.
Member Function Documentation
◆ begin()
|
pure virtual |
Creates a new transaction and associates it with the current thread.
- Exceptions
-
IllegalStateException if the thread is already associated with a transaction
- Since
- 3.6
◆ commit()
|
pure virtual |
Commit the transaction associated with the current thread.
If the commit operation fails due to a conflict it will destroy the transaction state and throw a CommitConflictException. If the commit operation succeeds, it returns after the transaction state has been merged with committed state. When this method completes, the thread is no longer associated with a transaction.
- Exceptions
-
IllegalStateException if the thread is not associated with a transaction CommitConflictException if the commit operation fails due to a write conflict. TransactionDataNodeHasDepartedException if the node hosting the transaction data has departed. This is only relevant for transaction that involve PartitionedRegions. TransactionDataNotColocatedException if at commit time, the data involved in the transaction has moved away from the transaction hosting node. This can only happen if rebalancing/recovery happens during a transaction that involves a PartitionedRegion. TransactionInDoubtException when Geode cannot tell which nodes have applied the transaction and which have not. This only occurs if nodes fail mid-commit, and only then in very rare circumstances.
◆ exists() [1/2]
|
pure virtual |
Reports the existence of a Transaction for this thread.
- Returns
- true if a transaction exists, false otherwise
- Since
- 3.6
◆ exists() [2/2]
|
pure virtual |
Reports the existence of a transaction for the given transactionId.
This method can be used to determine if a transaction with the given transaction identifier is currently in progress locally.
- Parameters
-
transactionId the given transaction identifier
- Returns
- true if the transaction is in progress, false otherwise.
- Since
- 3.6.2
- See also
- #isSuspended(TransactionId)
◆ getTransactionId()
|
pure virtual |
Returns the transaction identifier for the current thread.
- Returns
- the transaction identifier or null if no transaction exists
- Since
- 3.6.2
◆ isSuspended()
|
pure virtual |
This method can be used to determine if a transaction with the given transaction identifier is currently suspended locally.
This method does not check other members for transaction status.
- Parameters
-
transactionId transaction to check if is suspended
- Returns
- true if the transaction is in suspended state, false otherwise
- Since
- 3.6.2
- See also
- #exists(TransactionId)
◆ prepare()
|
pure virtual |
Performs prepare during 2 phase commit completion, for the transaction associated with the current thread.
Locks of the entries modified in the current transaction on the server side. If the prepare operation fails due to a conflict it will destroy the transaction state and throw a CommitConflictException. If the prepare operation succeeds, transaction state is set to prepared state. When this method completes, the thread is still associated with a transaction, and is waiting on commit or rollback operation.
- Exceptions
-
IllegalStateException if the thread is not associated with a transaction CommitConflictException if the commit operation fails due to a write conflict. TransactionDataNodeHasDepartedException if the node hosting the transaction data has departed. This is only relevant for transaction that involve PartitionedRegions. TransactionDataNotColocatedException if at commit time, the data involved in the transaction has moved away from the transaction hosting node. This can only happen if rebalancing/recovery happens during a transaction that involves a PartitionedRegion. TransactionInDoubtException when Geode cannot tell which nodes have applied the transaction and which have not. This only occurs if nodes fail mid-commit, and only then in very rare circumstances.
◆ resume()
|
pure virtual |
On the current thread, resumes a transaction that was previously suspended using suspend().
- Parameters
-
transactionId the transaction to resume
- Exceptions
-
IllegalStateException if the thread is associated with a transaction or if isSuspended(TransactionId)would return false for the given transactionId
- Since
- 3.6.2
◆ rollback()
|
pure virtual |
Roll back the transaction associated with the current thread.
When this method completes, the thread is no longer associated with a transaction and the transaction context is destroyed.
- Since
- 3.6
- Exceptions
-
IllegalStateException if the thread is not associated with a transaction
◆ suspend()
|
pure virtual |
Suspends the transaction on the current thread.
All subsequent operations performed by this thread will be non-transactional. The suspended transaction can be resumed by calling resume(TransactionId)
- Returns
- the transaction identifier of the suspended transaction or null if the thread was not associated with a transaction
- Since
- 3.6.2
◆ tryResume() [1/2]
|
pure virtual |
On the current thread, resumes a transaction that was previously suspended using suspend().
This method is equivalent to
if (isSuspended(txId)) {
resume(txId);
}
except that this action is performed atomically
- Parameters
-
transactionId the transaction to resume
- Returns
- true if the transaction was resumed, false otherwise
- Since
- 3.6.2
◆ tryResume() [2/2]
|
pure virtual |
On the current thread, resumes a transaction that was previously suspended using suspend(), or waits for the specified timeout interval if the transaction has not been suspended.
This method will return if:
- Another thread suspends the transaction
- Another thread calls commit/rollback on the transaction
- This thread has waited for the specified timeout
This method returns immediately if exists(TransactionId) returns false.
- Parameters
-
transactionId the transaction to resume waitTime the maximum time to wait
- Returns
- true if the transaction was resumed, false otherwise
- Since
- 3.6.2
- See also
- #tryResume(TransactionId)
Apache Geode C++ Cache API Documentation