Apache Geode Native .NET Reference 1.15.0
Apache::Geode::Client::CacheTransactionManager Class Reference

CacheTransactionManager encapsulates the transactions for a cache More...

#include <CacheTransactionManager.hpp>

Public Member Functions

void Begin ()
 Creates a new transaction and associates it with the current thread. More...
 
void Commit ()
 Commit the transaction associated with the current thread. More...
 
bool Exists ()
 Reports the existence of a Transaction for this thread More...
 
bool Exists (Apache::Geode::Client::TransactionId^ transactionId)
 Reports the existence of a transaction for the given transactionId. More...
 
bool IsSuspended (Apache::Geode::Client::TransactionId^ transactionId)
 This method can be used to determine if a transaction with the given transaction identifier is currently suspended locally. More...
 
void Prepare ()
 Prepare the first message of two-phase-commit transaction associated with the current thread. More...
 
void Resume (Apache::Geode::Client::TransactionId^ transactionId)
 On the current thread, resumes a transaction that was previously suspended using suspend More...
 
void Rollback ()
 Roll back the transaction associated with the current thread. More...
 
Apache::Geode::Client::TransactionIdSuspend ()
 Suspends the transaction on the current thread. More...
 
bool TryResume (Apache::Geode::Client::TransactionId^ transactionId)
 On the current thread, resumes a transaction that was previously suspended using suspend. More...
 
bool TryResume (Apache::Geode::Client::TransactionId^ transactionId, TimeSpan waitTime)
 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. More...
 

Properties

Apache::Geode::Client::TransactionIdTransactionId [get]
 Returns the transaction identifier for the current thread More...
 

Detailed Description

CacheTransactionManager encapsulates the transactions for a cache

Member Function Documentation

◆ Begin()

void Apache::Geode::Client::CacheTransactionManager::Begin ( )

Creates a new transaction and associates it with the current thread.

Exceptions
IllegalStateExceptionThrows exception if the thread is already associated with a transaction

◆ Commit()

void Apache::Geode::Client::CacheTransactionManager::Commit ( )

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
IllegalStateExceptionif the thread is not associated with a transaction
CommitConflictExceptionif the commit operation fails due to a write conflict.

◆ Exists() [1/2]

bool Apache::Geode::Client::CacheTransactionManager::Exists ( )

Reports the existence of a Transaction for this thread

Returns
true if a transaction exists, false otherwise

◆ Exists() [2/2]

bool Apache::Geode::Client::CacheTransactionManager::Exists ( Apache::Geode::Client::TransactionId transactionId)

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.

Since 3.6.2

Parameters
transactionIdthe given transaction identifier
Returns
true if the transaction is in progress, false otherwise.

isSuspended

◆ IsSuspended()

bool Apache::Geode::Client::CacheTransactionManager::IsSuspended ( Apache::Geode::Client::TransactionId transactionId)

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.

Since 3.6.2

Parameters
transactionId
Returns
true if the transaction is in suspended state, false otherwise

TransactionId

◆ Prepare()

void Apache::Geode::Client::CacheTransactionManager::Prepare ( )

Prepare the first message of two-phase-commit transaction associated with the current thread.

Exceptions
IllegalStateExceptionif the thread is not associated with a transaction
CommitConflictExceptionif the commit operation fails due to a write conflict.

◆ Resume()

void Apache::Geode::Client::CacheTransactionManager::Resume ( Apache::Geode::Client::TransactionId transactionId)

On the current thread, resumes a transaction that was previously suspended using suspend

Since 3.6.2

Parameters
transactionIdthe transaction to resume
Exceptions
IllegalStateExceptionif the thread is associated with a transaction or if would return false for the given transactionId

TransactionId

◆ Rollback()

void Apache::Geode::Client::CacheTransactionManager::Rollback ( )

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.

Exceptions
IllegalStateExceptionif the thread is not associated with a transaction


◆ Suspend()

Apache::Geode::Client::TransactionId ^ Apache::Geode::Client::CacheTransactionManager::Suspend ( )

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 TransactionId

Since 3.6.2

Returns
the transaction identifier of the suspended transaction or null if the thread was not associated with a transaction

◆ TryResume() [1/2]

bool Apache::Geode::Client::CacheTransactionManager::TryResume ( Apache::Geode::Client::TransactionId transactionId)

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

Since 3.6.2

Parameters
transactionIdthe transaction to resume
Returns
true if the transaction was resumed, false otherwise

◆ TryResume() [2/2]

bool Apache::Geode::Client::CacheTransactionManager::TryResume ( Apache::Geode::Client::TransactionId transactionId,
TimeSpan  waitTime 
)

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 TransactionId returns false.

Since 3.6.2

Parameters
transactionIdthe transaction to resume
waitTimethe maximum time to wait
Returns
true if the transaction was resumed, false otherwise

Property Documentation

◆ TransactionId

Apache:: Geode:: Client:: TransactionId^ Apache::Geode::Client::CacheTransactionManager::TransactionId
get

Returns the transaction identifier for the current thread

Since 3.6.2

Returns
the transaction identifier or null if no transaction exists

Apache Geode C++ Cache .NET API Documentation