@API(value=EXPERIMENTAL) public enum BlockingInAsyncDetection extends Enum<BlockingInAsyncDetection>
FDBDatabase.asyncToSync()
or FDBRecordContext.asyncToSync()
should
attempt to detect when it is being called from an asynchronous context and, if so, how it should react to
this fact. When this situation is detected, there are two scenarios that need to be dealt with:
IGNORE_COMPLETE
(silently ignore) or
WARN_COMPLETE
(log a warning).EXCEPTION_BLOCKING
(throw an exception) or WARN_BLOCKING
(log a warning).Enum Constant and Description |
---|
DISABLED
The detection of blocking in an asynchronous context is disabled.
|
IGNORE_COMPLETE_EXCEPTION_BLOCKING
When
asyncToSync is called in an asynchronous context and the future it is passed would
block, an exception will be thrown. |
IGNORE_COMPLETE_WARN_BLOCKING
When
asyncToSync is called in an asynchronous context and the future it is passed would
block, a warning is logged. |
WARN_COMPLETE_EXCEPTION_BLOCKING
When
asyncToSync is called in an asynchronous context and the future it is passed would
block, an exception will be thrown; however, if the future is complete, then a warning will be logged. |
WARN_COMPLETE_WARN_BLOCKING
When
asyncToSync is called in an asynchronous context, a warning is logged. |
Modifier and Type | Method and Description |
---|---|
boolean |
ignoreComplete()
Indicates how to react if the future passed into
asyncToSync() was completed. |
boolean |
throwExceptionOnBlocking()
Indicates how to react if the future passed into
asyncToSync() has not yet been completed. |
static BlockingInAsyncDetection |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static BlockingInAsyncDetection[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final BlockingInAsyncDetection DISABLED
public static final BlockingInAsyncDetection IGNORE_COMPLETE_EXCEPTION_BLOCKING
asyncToSync
is called in an asynchronous context and the future it is passed would
block, an exception will be thrown.public static final BlockingInAsyncDetection WARN_COMPLETE_EXCEPTION_BLOCKING
asyncToSync
is called in an asynchronous context and the future it is passed would
block, an exception will be thrown; however, if the future is complete, then a warning will be logged.public static final BlockingInAsyncDetection IGNORE_COMPLETE_WARN_BLOCKING
asyncToSync
is called in an asynchronous context and the future it is passed would
block, a warning is logged.public static final BlockingInAsyncDetection WARN_COMPLETE_WARN_BLOCKING
asyncToSync
is called in an asynchronous context, a warning is logged.public static BlockingInAsyncDetection[] values()
for (BlockingInAsyncDetection c : BlockingInAsyncDetection.values()) System.out.println(c);
public static BlockingInAsyncDetection valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean ignoreComplete()
asyncToSync()
was completed. A return
value of true
indicates that this situation should be ignored, and a value of false
indicates that a warning should be logged.public boolean throwExceptionOnBlocking()
asyncToSync()
has not yet been completed. A return
value of true
indicates that this situation should result in a BlockingInAsyncException
,
and a value of false
indicates that a warning should be logged.