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
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

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

int hazelcast::client::TransactionOptions::getDurability ( ) const
the transaction durability.
See also
int hazelcast::client::TransactionOptions::getTimeout ( ) const
the timeout in seconds.
TransactionType hazelcast::client::TransactionOptions::getTransactionType ( ) const
the TransactionType.
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.

durabilitythe durability
the updated TransactionOptions.
IllegalArgumentExceptionif durability smaller than 0.
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.

timeoutInSecondsthe timeout value in seconds.
the updated TransactionOptions
IllegalArgumentExceptionif timeout smaller or equal than 0, or timeUnit is null.
See also
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.

transactionTypethe new TransactionType.
the updated TransactionOptions.
See also

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