public static class FDBRecordContextConfig.Builder extends Object
FDBRecordContextConfig
s using the standard builder pattern.Modifier and Type | Method and Description |
---|---|
boolean |
areAssertionsEnabled()
Return whether or not correctness assertions will enabled for the context.
|
FDBRecordContextConfig |
build()
Create an
FDBRecordContextConfig from this builder. |
Map<String,String> |
getMdcContext()
Get the MDC context.
|
FDBTransactionPriority |
getPriority()
Get the
FDBTransactionPriority . |
FDBStoreTimer |
getTimer()
Get the timer to use to instrument events.
|
String |
getTransactionId()
Get the ID to use for the transaction within FDB logs.
|
FDBDatabase.WeakReadSemantics |
getWeakReadSemantics()
Get the
FDBDatabase.WeakReadSemantics from this
configuration. |
FDBRecordContextConfig.Builder |
setEnableAssertions(boolean enableAssertions)
Enables or disables internal correctness assertions for the context, such as validating maximum key and
value lengths for all database requests.
|
FDBRecordContextConfig.Builder |
setMdcContext(Map<String,String> mdcContext)
Set the MDC context.
|
FDBRecordContextConfig.Builder |
setPriority(FDBTransactionPriority priority)
Set the
FDBTransactionPriority to use when creating a transaction. |
FDBRecordContextConfig.Builder |
setTimer(FDBStoreTimer timer)
Set the timer to use when instrumenting events.
|
FDBRecordContextConfig.Builder |
setTransactionId(String transactionId)
Set the transaction ID to use within FDB logs.
|
FDBRecordContextConfig.Builder |
setTransactionTimeoutMillis(long transactionTimeoutMillis)
Set the transaction timeout time in milliseconds.
|
FDBRecordContextConfig.Builder |
setWeakReadSemantics(FDBDatabase.WeakReadSemantics weakReadSemantics)
Set the
FDBDatabase.WeakReadSemantics to use
when creating a transaction. |
@Nonnull public FDBRecordContextConfig.Builder setMdcContext(@Nullable Map<String,String> mdcContext)
null
, which does not add any additional
keys or values to the logs. Additionally, if the "uuid" key of this parameter is set and the
transaction ID parameter is not set, then the transaction will set its logging ID based
on the value of that key from the MDC context.mdcContext
- the MDC context to use when loggingFDBRecordContextConfig.getMdcContext()
,
setTransactionId(String)
@Nullable public Map<String,String> getMdcContext()
FDBRecordContextConfig.getMdcContext()
@Nonnull public FDBRecordContextConfig.Builder setTimer(@Nullable FDBStoreTimer timer)
null
, when means that events will not be instrumented.timer
- the timer to use to instrument eventsFDBRecordContextConfig.getTimer()
@Nullable public FDBStoreTimer getTimer()
FDBRecordContextConfig.getTimer()
@Nonnull public FDBRecordContextConfig.Builder setWeakReadSemantics(@Nullable FDBDatabase.WeakReadSemantics weakReadSemantics)
FDBDatabase.WeakReadSemantics
to use
when creating a transaction. The default value is null
, which indicates that the
transaction should not use a cached read version and will not set
TransactionOptions.setCausalReadRisky()
. This guarantees that the
transaction will be linearizable, i.e., it will see all commits from all transactions that
have committed before it.weakReadSemantics
- the FDBDatabase.WeakReadSemantics
to use when creating the transactionFDBRecordContextConfig.getWeakReadSemantics()
@Nullable public FDBDatabase.WeakReadSemantics getWeakReadSemantics()
FDBDatabase.WeakReadSemantics
from this
configuration.FDBDatabase.WeakReadSemantics
FDBRecordContextConfig.getWeakReadSemantics()
@Nonnull public FDBRecordContextConfig.Builder setPriority(@Nonnull FDBTransactionPriority priority)
FDBTransactionPriority
to use when creating a transaction. By default, this
will be set to FDBTransactionPriority.DEFAULT
. For more details on what this value
means, see FDBTransactionPriority
.priority
- the priority to use when creating a transactionFDBTransactionPriority
,
FDBRecordContextConfig.getPriority()
@Nonnull public FDBTransactionPriority getPriority()
FDBTransactionPriority
.FDBRecordContextConfig.getPriority()
@Nonnull public FDBRecordContextConfig.Builder setTransactionId(@Nullable String transactionId)
null
, which indicates that the transaction should look at the "uuid" key of the
MDC context (if set) to set the transaction ID.
The transaction ID should typically be set to a string of entirely ASCII characters, and
it should not exceed 100 bytes in length. If the string is longer than 100 bytes, then the
ID may be truncated or dropped. See FDBRecordContext.getTransactionId()
.
transactionId
- the ID to use for the transaction in FDB logsFDBRecordContextConfig.getTransactionId()
,
FDBRecordContext.getTransactionId()
@Nullable public String getTransactionId()
FDBRecordContextConfig.getTransactionId()
@Nonnull public FDBRecordContextConfig.Builder setTransactionTimeoutMillis(long transactionTimeoutMillis)
FDBDatabaseFactory.DEFAULT_TR_TIMEOUT_MILLIS
,
which indicates that a created transaction should inherit its default from the FDBDatabaseFactory
used to create it. If set to FDBDatabaseFactory.UNLIMITED_TR_TIMEOUT_MILLIS
, then no timeout will
be imposed on the transaction. Otherwise, the transaction will be configured to automatically cancel
itself after the configured number of milliseconds.transactionTimeoutMillis
- the timeout time in millisecondsFDBRecordContextConfig.getTransactionTimeoutMillis()
,
FDBDatabaseFactory.setTransactionTimeoutMillis(long)
public FDBRecordContextConfig.Builder setEnableAssertions(boolean enableAssertions)
enableAssertions
- whether or not assertions are enabledpublic boolean areAssertionsEnabled()
true
if correctness assertions are to be enabled for the context@Nonnull public FDBRecordContextConfig build()
FDBRecordContextConfig
from this builder.FDBRecordContextConfig
with its values set based on this builder