Class TransactionOptions
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voiddisposeInternal(long handle) longGets the number of traversals to make during deadlock detection.longExpiration duration in milliseconds.longThe wait timeout in milliseconds when a transaction attempts to lock a key.longGet the maximum number of bytes that may be used for the write batch.booleanTrue means that before acquiring locks, this transaction will check if doing so will cause a deadlock.booleansetDeadlockDetect(boolean deadlockDetect) Setting to true means that before acquiring locks, this transaction will check if doing so will cause a deadlock.setDeadlockDetectDepth(long deadlockDetectDepth) Sets the number of traversals to make during deadlock detection.setExpiration(long expiration) Expiration duration in milliseconds.setLockTimeout(long lockTimeout) If positive, specifies the wait timeout in milliseconds when a transaction attempts to lock a key.setMaxWriteBatchSize(long maxWriteBatchSize) Set the maximum number of bytes that may be used for the write batch.setSetSnapshot(boolean setSnapshot) Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
close
-
Constructor Details
-
TransactionOptions
public TransactionOptions()
-
-
Method Details
-
isSetSnapshot
public boolean isSetSnapshot() -
setSetSnapshot
-
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
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
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 usedDefault: -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
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
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
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
-