public final class TransactionOptions extends Object implements DataSerializable
Modifier and Type | Class and Description |
---|---|
static class |
TransactionOptions.TransactionType
The type of transaction.
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT_MILLIS
2 minutes as default timeout value
|
Constructor and Description |
---|
TransactionOptions()
Creates a new default configured TransactionsOptions.
|
Modifier and Type | Method and Description |
---|---|
static TransactionOptions |
getDefault()
Creates a new TransactionOptions configured with default settings.
|
int |
getDurability()
Gets the transaction durability.
|
long |
getTimeoutMillis()
Gets the timeout in milliseconds.
|
TransactionOptions.TransactionType |
getTransactionType()
Gets the
TransactionOptions.TransactionType . |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
TransactionOptions |
setDurability(int durability)
Sets the transaction durability.
|
TransactionOptions |
setTimeout(long timeout,
TimeUnit timeUnit)
Sets the timeout.
|
TransactionOptions |
setTransactionType(TransactionOptions.TransactionType transactionType)
Sets the
TransactionOptions.TransactionType . |
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public static final long DEFAULT_TIMEOUT_MILLIS
public TransactionOptions()
public TransactionOptions.TransactionType getTransactionType()
TransactionOptions.TransactionType
.public TransactionOptions setTransactionType(TransactionOptions.TransactionType transactionType)
TransactionOptions.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.getTransactionType()
,
setDurability(int)
public long getTimeoutMillis()
setTimeout(long, java.util.concurrent.TimeUnit)
public TransactionOptions setTimeout(long timeout, TimeUnit timeUnit)
timeout
- the timeout.timeUnit
- the TimeUnit of the timeout.IllegalArgumentException
- if timeout smaller or equal than 0, or timeUnit is null.getTimeoutMillis()
public int getDurability()
setDurability(int)
public TransactionOptions setDurability(int durability)
TransactionOptions.TransactionType.TWO_PHASE
is selected.durability
- the durabilityIllegalArgumentException
- if durability smaller than 0.public static TransactionOptions getDefault()
TransactionOptions()
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.