Package org.rocksdb
Class TransactionOptions
- java.lang.Object
-
- org.rocksdb.AbstractNativeReference
-
- org.rocksdb.AbstractImmutableNativeReference
-
- org.rocksdb.RocksObject
-
- org.rocksdb.TransactionOptions
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class TransactionOptions extends RocksObject
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Constructor Summary
Constructors Constructor Description TransactionOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddisposeInternal(long handle)longgetDeadlockDetectDepth()Gets the number of traversals to make during deadlock detection.longgetExpiration()Expiration duration in milliseconds.longgetLockTimeout()The wait timeout in milliseconds when a transaction attempts to lock a key.longgetMaxWriteBatchSize()Get the maximum number of bytes that may be used for the write batch.booleanisDeadlockDetect()True means that before acquiring locks, this transaction will check if doing so will cause a deadlock.booleanisSetSnapshot()TransactionOptionssetDeadlockDetect(boolean deadlockDetect)Setting to true means that before acquiring locks, this transaction will check if doing so will cause a deadlock.TransactionOptionssetDeadlockDetectDepth(long deadlockDetectDepth)Sets the number of traversals to make during deadlock detection.TransactionOptionssetExpiration(long expiration)Expiration duration in milliseconds.TransactionOptionssetLockTimeout(long lockTimeout)If positive, specifies the wait timeout in milliseconds when a transaction attempts to lock a key.TransactionOptionssetMaxWriteBatchSize(long maxWriteBatchSize)Set the maximum number of bytes that may be used for the write batch.TransactionOptionssetSetSnapshot(boolean setSnapshot)-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Method Detail
-
isSetSnapshot
public boolean isSetSnapshot()
-
setSetSnapshot
public TransactionOptions setSetSnapshot(boolean setSnapshot)
-
isDeadlockDetect
public boolean isDeadlockDetect()
True means that before acquiring locks, this transaction will check if doing so will cause a deadlock. If so, it will return withStatus.Code.Busy. The user should retry their transaction.- Returns:
- true if a deadlock is detected.
-
setDeadlockDetect
public TransactionOptions setDeadlockDetect(boolean deadlockDetect)
Setting to true means that before acquiring locks, this transaction will check if doing so will cause a deadlock. If so, it will return withStatus.Code.Busy. The user should retry their transaction.- Parameters:
deadlockDetect- true if we should detect deadlocks.- Returns:
- this TransactionOptions instance
-
getLockTimeout
public long getLockTimeout()
The wait timeout in milliseconds when a transaction attempts to lock a key. If 0, no waiting is done if a lock cannot instantly be acquired. If negative,TransactionDBOptions.getTransactionLockTimeout(long)will be used- Returns:
- the lock timeout in milliseconds
-
setLockTimeout
public TransactionOptions setLockTimeout(long lockTimeout)
If positive, specifies the wait timeout in milliseconds when a transaction attempts to lock a key. If 0, no waiting is done if a lock cannot instantly be acquired. If negative,TransactionDBOptions.getTransactionLockTimeout(long)will be used Default: -1- Parameters:
lockTimeout- the lock timeout in milliseconds- Returns:
- this TransactionOptions instance
-
getExpiration
public long getExpiration()
Expiration duration in milliseconds. If non-negative, transactions that last longer than this many milliseconds will fail to commit. If not set, a forgotten transaction that is never committed, rolled back, or deleted will never relinquish any locks it holds. This could prevent keys from being written by other writers.- Returns:
- expiration the expiration duration in milliseconds
-
setExpiration
public TransactionOptions setExpiration(long expiration)
Expiration duration in milliseconds. If non-negative, transactions that last longer than this many milliseconds will fail to commit. If not set, a forgotten transaction that is never committed, rolled back, or deleted will never relinquish any locks it holds. This could prevent keys from being written by other writers. Default: -1- Parameters:
expiration- the expiration duration in milliseconds- Returns:
- this TransactionOptions instance
-
getDeadlockDetectDepth
public long getDeadlockDetectDepth()
Gets the number of traversals to make during deadlock detection.- Returns:
- the number of traversals to make during deadlock detection
-
setDeadlockDetectDepth
public TransactionOptions setDeadlockDetectDepth(long deadlockDetectDepth)
Sets the number of traversals to make during deadlock detection. Default: 50- Parameters:
deadlockDetectDepth- the number of traversals to make during deadlock detection- Returns:
- this TransactionOptions instance
-
getMaxWriteBatchSize
public long getMaxWriteBatchSize()
Get the maximum number of bytes that may be used for the write batch.- Returns:
- the maximum number of bytes, 0 means no limit.
-
setMaxWriteBatchSize
public TransactionOptions setMaxWriteBatchSize(long maxWriteBatchSize)
Set the maximum number of bytes that may be used for the write batch.- Parameters:
maxWriteBatchSize- the maximum number of bytes, 0 means no limit.- Returns:
- this TransactionOptions instance
-
disposeInternal
protected final void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-