public interface ExecutionContext
The scope of a context can be either global, if it is associated with a global execution event
such as onExecutionStarted or onExecutionSuccessful; or local to a request-response cycle, if it is
associated with a request execution event such as ExecutionListener.onWriteRequestStarted(Statement, ExecutionContext) or ExecutionListener.onWriteRequestSuccessful(Statement, ExecutionContext).
See the javadocs of ExecutionListener to understand when its scope is global or local.
ExecutionListener| Modifier and Type | Method and Description |
|---|---|
long |
elapsedTimeNanos()
Returns the elapsed time, in nanoseconds, between start and end of execution.
|
Optional<Object> |
getAttribute(Object key)
Retrieves an attribute stored in this context.
|
void |
setAttribute(Object key,
Object value)
Sets an attribute into this context.
|
void setAttribute(Object key, Object value)
key - the attribute key. Cannot be null.value - the attribute value. Can be null.Optional<Object> getAttribute(Object key)
key - the attribute key. Cannot be null.Optional containing the attribute value, if present.long elapsedTimeNanos()
The exact meaning of the value returned by this method depends on whether the context is global or local: for global contexts, this is the elapsed time for the whole statement execution; for local ones, this is the elapsed time for a single request-response cycle.
Copyright © 2017–2021 DataStax. All rights reserved.