com.apple.foundationdb

## Class TransactionOptions

- java.lang.Object
- - com.apple.foundationdb.TransactionOptions

    public class TransactionOptions
    extends java.lang.Object

A set of options that can be set on a `Transaction`.

### Constructor Summary

Constructors
Constructor and Description
`TransactionOptions(OptionConsumer consumer)`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`OptionConsumer` `getOptionConsumer()` Returns the object on which these options are being set.
`void` `setAccessSystemKeys()` Allows this transaction to read and modify system keys (those that start with the byte 0xFF).
`void` `setCausalReadDisable()`
`void` `setCausalReadRisky()` The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a fault or partition.
`void` `setCausalWriteRisky()` The transaction, if not self-conflicting, may be committed a second time after commit succeeds, in the event of a fault.
`void` `setDebugRetryLogging(java.lang.String value)`
`void` `setDurabilityDatacenter()`
`void` `setDurabilityDevNullIsWebScale()` Deprecated.
`void` `setDurabilityRisky()`
`void` `setInitializeNewDatabase()` This is a write-only transaction which sets the initial configuration.
`void` `setLockAware()` The transaction can read and write to locked databases, and is resposible for checking that it took the lock.
`void` `setMaxRetryDelay(long value)` Set the maximum amount of backoff delay incurred in the call to onError if the error is retryable.
`void` `setNextWriteNoWriteConflictRange()` The next write performed on this transaction will not generate a write conflict range.
`void` `setPriorityBatch()` Specifies that this transaction should be treated as low priority and that default priority transactions should be processed first.
`void` `setPrioritySystemImmediate()` Specifies that this transaction should be treated as highest priority and that lower priority transactions should block behind this one.
`void` `setReadAheadDisable()` Deprecated.
`void` `setReadLockAware()` The transaction can read from locked databases.
`void` `setReadSystemKeys()` Allows this transaction to read system keys (those that start with the byte 0xFF).
`void` `setReadYourWritesDisable()` Reads performed by a transaction will not see any prior mutations that occured in that transaction, instead seeing the value which was in the database at the transaction's read version.
`void` `setRetryLimit(long value)` Set a maximum number of retries after which additional calls to onError will throw the most recently seen error code.
`void` `setSnapshotRywDisable()` Snapshot read operations will not see the results of writes done in the same transaction.
`void` `setSnapshotRywEnable()` Snapshot read operations will see the results of writes done in the same transaction.
`void` `setTimeout(long value)` Set a timeout in milliseconds which, when elapsed, will cause the transaction automatically to be cancelled.
`void` `setTransactionLoggingEnable(java.lang.String value)` Enables tracing for this transaction and logs results to the client trace logs.
`void` `setUsedDuringCommitProtectionDisable()` By default, operations that are performed on a transaction while it is being committed will not only fail themselves, but they will attempt to fail other in-flight operations (such as the commit) as well.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TransactionOptions

    public TransactionOptions(OptionConsumer consumer)

### Method Detail

#### setCausalWriteRisky

    public void setCausalWriteRisky()

The transaction, if not self-conflicting, may be committed a second time after commit succeeds, in the event of a fault.

#### setCausalReadRisky

    public void setCausalReadRisky()

The read version will be committed, and usually will be the latest committed, but might not be the latest committed in the event of a fault or partition.

#### setNextWriteNoWriteConflictRange

    public void setNextWriteNoWriteConflictRange()

The next write performed on this transaction will not generate a write conflict range. As a result, other transactions which read the key(s) being modified by the next write will not conflict with this transaction. Care needs to be taken when using this option on a transaction that is shared between multiple threads. When setting this option, write conflict ranges will be disabled on the next write operation, regardless of what thread it is on.

#### setReadYourWritesDisable

    public void setReadYourWritesDisable()

Reads performed by a transaction will not see any prior mutations that occured in that transaction, instead seeing the value which was in the database at the transaction's read version. This option may provide a small performance benefit for the client, but also disables a number of client-side optimizations which are beneficial for transactions which tend to read and write the same keys within a single transaction.

#### setReadAheadDisable

    @Deprecated
    public void setReadAheadDisable()

Deprecated.
Deprecated.

#### setDurabilityDevNullIsWebScale

    @Deprecated
    public void setDurabilityDevNullIsWebScale()

Deprecated.
Deprecated.

#### setPrioritySystemImmediate

    public void setPrioritySystemImmediate()

Specifies that this transaction should be treated as highest priority and that lower priority transactions should block behind this one. Use is discouraged outside of low-level tools.

#### setPriorityBatch

    public void setPriorityBatch()

Specifies that this transaction should be treated as low priority and that default priority transactions should be processed first. Useful for doing batch work simultaneously with latency-sensitive work.

#### setInitializeNewDatabase

    public void setInitializeNewDatabase()

This is a write-only transaction which sets the initial configuration. This option is designed for use by database system tools only.

#### setAccessSystemKeys

    public void setAccessSystemKeys()

Allows this transaction to read and modify system keys (those that start with the byte 0xFF).

#### setReadSystemKeys

    public void setReadSystemKeys()

Allows this transaction to read system keys (those that start with the byte 0xFF).

#### setTransactionLoggingEnable

    public void setTransactionLoggingEnable(java.lang.String value)

Enables tracing for this transaction and logs results to the client trace logs. Client trace logging must be enabled to get log output.

Parameters:
  `value` - String identifier to be used in the logs when tracing this transaction. The identifier must not exceed 100 characters.

#### setTimeout

    public void setTimeout(long value)

Set a timeout in milliseconds which, when elapsed, will cause the transaction automatically to be cancelled. Valid parameter values are `[0, INT_MAX]`. If set to 0, will disable all timeouts. All pending and any future uses of the transaction will throw an exception. The transaction can be used again after it is reset. Like all transaction options, a timeout must be reset after a call to onError. This behavior allows the user to make the timeout dynamic.

Parameters:
  `value` - value in milliseconds of timeout

#### setRetryLimit

    public void setRetryLimit(long value)

Set a maximum number of retries after which additional calls to onError will throw the most recently seen error code. Valid parameter values are `[-1, INT_MAX]`. If set to -1, will disable the retry limit. Like all transaction options, the retry limit must be reset after a call to onError. This behavior allows the user to make the retry limit dynamic.

Parameters:
  `value` - number of times to retry

#### setMaxRetryDelay

    public void setMaxRetryDelay(long value)

Set the maximum amount of backoff delay incurred in the call to onError if the error is retryable. Defaults to 1000 ms. Valid parameter values are `[0, INT_MAX]`. Like all transaction options, the maximum retry delay must be reset after a call to onError. If the maximum retry delay is less than the current retry delay of the transaction, then the current retry delay will be clamped to the maximum retry delay.

Parameters:
  `value` - value in milliseconds of maximum delay

#### setSnapshotRywEnable

    public void setSnapshotRywEnable()

Snapshot read operations will see the results of writes done in the same transaction.

#### setSnapshotRywDisable

    public void setSnapshotRywDisable()

Snapshot read operations will not see the results of writes done in the same transaction.

#### setLockAware

    public void setLockAware()

The transaction can read and write to locked databases, and is resposible for checking that it took the lock.

#### setUsedDuringCommitProtectionDisable

    public void setUsedDuringCommitProtectionDisable()

By default, operations that are performed on a transaction while it is being committed will not only fail themselves, but they will attempt to fail other in-flight operations (such as the commit) as well. This behavior is intended to help developers discover situations where operations could be unintentionally executed after the transaction has been reset. Setting this option removes that protection, causing only the offending operation to fail.

#### setReadLockAware

    public void setReadLockAware()

The transaction can read from locked databases.

#### setCausalReadDisable

    public void setCausalReadDisable()

#### setDurabilityDatacenter

    public void setDurabilityDatacenter()

#### setDurabilityRisky

    public void setDurabilityRisky()

#### setDebugRetryLogging

    public void setDebugRetryLogging(java.lang.String value)

#### getOptionConsumer

    public OptionConsumer getOptionConsumer()

Returns the object on which these options are being set. Rarely used by client code, since all options should be top-level methods on extending classes.

Returns:
  target of option set calls