Contains the configuration for a Hazelcast transaction.
More...
#include <transaction_options.h>
Contains the configuration for a Hazelcast transaction.
◆ transaction_options()
hazelcast::client::transaction_options::transaction_options |
( |
| ) |
|
Creates a new default configured TransactionsOptions.
It will be configured with a timeout of 2 minutes, durability of 1 and a TransactionType.TWO_PHASE.
◆ get_durability()
int hazelcast::client::transaction_options::get_durability |
( |
| ) |
const |
- Returns
- the transaction durability.
- See also
- #setDurability(int)
◆ get_timeout()
std::chrono::milliseconds hazelcast::client::transaction_options::get_timeout |
( |
| ) |
const |
◆ get_transaction_type()
- Returns
- the TransactionType.
◆ set_durability()
transaction_options & hazelcast::client::transaction_options::set_durability |
( |
int |
num_machines | ) |
|
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
-
- Returns
- the updated TransactionOptions.
- Exceptions
-
illegal_argument | if durability smaller than 0. |
◆ set_timeout()
transaction_options & hazelcast::client::transaction_options::set_timeout |
( |
std::chrono::milliseconds |
duration | ) |
|
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
-
timeoutInSeconds | the timeout value. |
- Returns
- the updated TransactionOptions
- Exceptions
-
illegal_argument | if timeout smaller or equal than 0, or timeUnit is null. |
- See also
- #getTimeout()
◆ set_transaction_type()
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
-
transactionType | the new TransactionType. |
- Returns
- the updated TransactionOptions.
- See also
- #getTransactionType()
-
#setDurability(int)
The documentation for this class was generated from the following files: