Hazelcast C++ Client
|
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 |
TransactionOptions & | setTransactionType (TransactionType transactionType) |
Sets the TransactionType. More... | |
int | getTimeout () const |
TransactionOptions & | setTimeout (int timeoutInSeconds) |
The timeout determines the maximum lifespan of a transaction. More... | |
int | getDurability () const |
TransactionOptions & | setDurability (int durability) |
Sets the transaction durability. More... | |
Contains the configuration for a Hazelcast transaction.
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.
int hazelcast::client::TransactionOptions::getDurability | ( | ) | const |
int hazelcast::client::TransactionOptions::getTimeout | ( | ) | const |
TransactionType hazelcast::client::TransactionOptions::getTransactionType | ( | ) | const |
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.
durability | the durability |
IllegalArgumentException | if 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.
timeoutInSeconds | the timeout value in seconds. |
IllegalArgumentException | if timeout smaller or equal than 0, or timeUnit is null. |
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.
transactionType | the new TransactionType. |