Hazelcast C++ Client
Public Member Functions | List of all members
hazelcast::client::TransactionOptions Class Reference

Contains the configuration for a Hazelcast transaction. More...

#include <TransactionOptions.h>

Public Member Functions

 TransactionOptions ()
 Creates a new default configured TransactionsOptions. More...
 
TransactionType getTransactionType () const
 
TransactionOptionssetTransactionType (TransactionType transactionType)
 Sets the TransactionType. More...
 
int getTimeout () const
 
int getTimeoutMillis () const
 
TransactionOptionssetTimeout (int timeoutInSeconds)
 The timeout determines the maximum lifespan of a transaction. More...
 
int getDurability () const
 
TransactionOptionssetDurability (int durability)
 Sets the transaction durability. More...
 

Detailed Description

Contains the configuration for a Hazelcast transaction.

Constructor & Destructor Documentation

◆ TransactionOptions()

hazelcast::client::TransactionOptions::TransactionOptions ( )

Creates a new default configured TransactionsOptions.

It will be configured with a timeout of 2 minutes, durability of 1 and a TransactionType.TWO_PHASE.

Member Function Documentation

◆ getDurability()

int hazelcast::client::TransactionOptions::getDurability ( ) const
Returns
the transaction durability.
See also
setDurability(int)

◆ getTimeout()

int hazelcast::client::TransactionOptions::getTimeout ( ) const
Returns
the timeout in seconds.

◆ getTimeoutMillis()

int hazelcast::client::TransactionOptions::getTimeoutMillis ( ) const
Returns
the timeout in milliseconds

◆ getTransactionType()

TransactionType hazelcast::client::TransactionOptions::getTransactionType ( ) const
Returns
the TransactionType.

◆ setDurability()

TransactionOptions & hazelcast::client::TransactionOptions::setDurability ( int  durability)

Sets the transaction durability.

The durability is the number of machines that can take over if a member fails during a transaction commit or rollback. This value only has meaning when TransactionType::TWO_PHASE is selected.

Parameters
durabilitythe durability
Returns
the updated TransactionOptions.
Exceptions
IllegalArgumentExceptionif durability smaller than 0.

◆ setTimeout()

TransactionOptions & hazelcast::client::TransactionOptions::setTimeout ( int  timeoutInSeconds)

The timeout determines the maximum lifespan of a transaction.

So if a transaction is configured with a timeout of 2 minutes, then it will automatically rollback if it hasn't committed yet.

Parameters
timeoutInSecondsthe timeout value in seconds.
Returns
the updated TransactionOptions
Exceptions
IllegalArgumentExceptionif timeout smaller or equal than 0, or timeUnit is null.
See also
getTimeout()

◆ setTransactionType()

TransactionOptions & hazelcast::client::TransactionOptions::setTransactionType ( TransactionType  transactionType)

Sets the TransactionType.

A local transaction is less safe than a two phase transaction; when a member fails during the commit of a local transaction, it could be that some of the changes are committed, while others are not and this can leave your system in an inconsistent state.

Parameters
transactionTypethe new TransactionType.
Returns
the updated TransactionOptions.
See also
getTransactionType()
setDurability(int)

The documentation for this class was generated from the following files: