OperationContext Class

Definition

Represents the current logical operation. A logical operation may have a one-to-many relationship with multiple individual physical requests.

public class OperationContext
Inheritance
java.lang.Object
OperationContext

Constructors

OperationContext()

Creates an instance of the class.

Fields

defaultLoggerName

Name of the org.slf4j.Logger that will be created by default if logging is enabled and a org.slf4j.Logger has not been specified.

Methods

appendRequestResult(RequestResult requestResult)

Reserved for internal use. Appends a RequestResult object to the internal collection in a synchronized manner.

getClientRequestID()

Gets the client side trace ID.

getClientTimeInMs()

Gets the operation latency, in milliseconds, from the client's perspective. This may include any potential retries.

getDefaultProxy()

Gets the default proxy used by the client library if enabled. The default can be overridden to enable a proxy for an individual operation context instance by using setProxy.

getErrorReceivingResponseEventHandler()

Gets an event multi-caster that is triggered when a network error occurs before the HTTP response status and headers are received. It allows event listeners to be dynamically added and removed.

getGlobalErrorReceivingResponseEventHandler()

Gets a global event multi-caster that is triggered when a network error occurs before the HTTP response status and headers are received. It allows event listeners to be dynamically added and removed.

getGlobalRequestCompletedEventHandler()

Gets a global event multi-caster that is triggered when a request is completed. It allows event listeners to be dynamically added and removed.

getGlobalResponseReceivedEventHandler()

Gets a global event multi-caster that is triggered when a response is received. It allows event listeners to be dynamically added and removed.

getGlobalRetryingEventHandler()

Gets a global event multi-caster that is triggered when a request is retried. It allows event listeners to be dynamically added and removed.

getGlobalSendingRequestEventHandler()

Gets a global event multi-caster that is triggered before sending a request. It allows event listeners to be dynamically added and removed.

getLastResult()

Gets the last request result encountered for the operation.

getLogger()

Gets the org.slf4j.Logger associated with this operation. If the org.slf4j.Logger object associated with this operation is null, this will return the class's default org.slf4j.Logger object.

getProxy()

Gets a proxy which will be used when making a request. Default is . To set a proxy to use by default, use setDefaultProxy

getRequestCompletedEventHandler()

Gets an event multi-caster that is triggered when a request is completed. It allows event listeners to be dynamically added and removed.

getRequestResults()

Returns the set of request results that the current operation has created.

getResponseReceivedEventHandler()

Gets an event multi-caster that is triggered when a response is received. It allows event listeners to be dynamically added and removed.

getRetryingEventHandler()

Gets an event multi-caster that is triggered when a request is retried. It allows event listeners to be dynamically added and removed.

getSendingRequestEventHandler()

Gets an event multi-caster that is triggered before sending a request. It allows event listeners to be dynamically added and removed.

getUserHeaders()

Gets any additional headers for the request, for example, for proxy or logging information.

initialize()

Reserved for internal use. Initializes the in order to begin processing a new operation. All operation specific information is erased.

isLoggingEnabled()

Indicates whether log entries will be produced for this request.

isLoggingEnabledByDefault()

Indicates whether the client library should produce log entries by default. The default can be overridden to enable logging for an individual operation context instance by using setLoggingEnabled.

setClientRequestID(final String clientRequestID)

Sets the client side request ID.

setClientTimeInMs(final long clientTimeInMs)

Reserved for internal use. Represents the operation latency, in milliseconds, from the client's perspective. This may include any potential retries.

setDefaultProxy(Proxy defaultProxy)

Specifies the proxy the client library should use by default. The default can be overridden to turn on a proxy for an individual operation context instance by using setProxy.

setErrorReceivingResponseEventHandler(final StorageEventMultiCaster<ErrorReceivingResponseEvent, StorageEvent<ErrorReceivingResponseEvent>> errorReceivingResponseEventHandler)

Sets an event multi-caster that is triggered when a network error occurs before the HTTP response status and headers are received.

setGlobalErrorReceivingResponseEventHandler(final StorageEventMultiCaster<ErrorReceivingResponseEvent, StorageEvent<ErrorReceivingResponseEvent>> globalErrorReceivingResponseEventHandler)

Sets a global event multi-caster that is triggered when a network error occurs before the HTTP response status and headers are received.

setGlobalRequestCompletedEventHandler(final StorageEventMultiCaster<RequestCompletedEvent, StorageEvent<RequestCompletedEvent>> globalRequestCompletedEventHandler)

Sets a global event multi-caster that is triggered when a request is completed.

setGlobalResponseReceivedEventHandler(final StorageEventMultiCaster<ResponseReceivedEvent, StorageEvent<ResponseReceivedEvent>> globalResponseReceivedEventHandler)

Sets a global event multi-caster that is triggered when a response is received.

setGlobalRetryingEventHandler(final StorageEventMultiCaster<RetryingEvent, StorageEvent<RetryingEvent>> globalRetryingEventHandler)

Sets a global event multi-caster that is triggered when a request is retried.

setGlobalSendingRequestEventHandler(final StorageEventMultiCaster<SendingRequestEvent, StorageEvent<SendingRequestEvent>> globalSendingRequestEventHandler)

Sets a global event multi-caster that is triggered before sending a request.

setLogger(final org.slf4j.Logger logger)

Sets the org.slf4j.Logger for this operation.

setLoggingEnabled(boolean loggingEnabled)

Specifies whether log entries will be produced for this request.

setLoggingEnabledByDefault(boolean enableLoggingByDefault)

Specifies whether the client library should produce log entries by default. The default can be overridden to turn on logging for an individual operation context instance by using setLoggingEnabled.

setProxy(Proxy proxy)

Sets a proxy which will be used when making a request. Default is . To set a proxy to use by default, use setDefaultProxy

setRequestCompletedEventHandler(final StorageEventMultiCaster<RequestCompletedEvent, StorageEvent<RequestCompletedEvent>> requestCompletedEventHandler)

Sets an event multi-caster that is triggered when a request is completed.

setResponseReceivedEventHandler(final StorageEventMultiCaster<ResponseReceivedEvent, StorageEvent<ResponseReceivedEvent>> responseReceivedEventHandler)

Sets an event multi-caster that is triggered when a response is received.

setRetryingEventHandler(final StorageEventMultiCaster<RetryingEvent, StorageEvent<RetryingEvent>> retryingEventHandler)

Sets an event multi-caster that is triggered when a request is retried.

setSendingRequestEventHandler(final StorageEventMultiCaster<SendingRequestEvent, StorageEvent<SendingRequestEvent>> sendingRequestEventHandler)

Sets an event multi-caster that is triggered before sending a request.

setUserHeaders(final HashMap<String, String> userHeaders)

Sets any additional headers for the request, for example, for proxy or logging information.

Applies to