Package com.couchbase.client.core.msg
Class RequestContext
java.lang.Object
com.couchbase.client.core.cnc.AbstractContext
com.couchbase.client.core.CoreContext
com.couchbase.client.core.msg.RequestContext
- All Implemented Interfaces:
Context
Additional context which might be attached to an individual
Request
.- Since:
- 2.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.couchbase.client.core.cnc.Context
Context.ExportFormat
-
Constructor Summary
ConstructorDescriptionRequestContext
(CoreContext ctx, Request<? extends Response> request) RequestContext
(Core core, long contextId, CoreEnvironment environment, Authenticator authenticator, Request<? extends Response> request) -
Method Summary
Modifier and TypeMethodDescriptioncancel()
Allows to cancel the attachedRequest
from anywhere in the code.Returns the custom user payload of this request.clientContext
(Map<String, Object> clientContext) Allows to set a custom payload for this request.long
Returns the duration of the dispatch phase if set.dispatchLatency
(long dispatchLatency) Allows to set the dispatch duration of the request.long
encodeLatency
(long encodeLatency) incrementRetryAttempts
(Duration lastRetryDuration, RetryReason reason) void
injectExportableParams
(Map<String, Object> input) This method needs to be implemented by the actual context implementations to inject the params they need for exporting.lastChannelId
(String lastChannelId) lastDispatchedFrom
(HostAndPort lastDispatchedFrom) lastDispatchedTo
(HostAndPort lastDispatchedTo) lastDispatchedToNode
(NodeIdentifier lastDispatchedToNode) Signals that this request is completed fully, including streaming sections or logical sub-requests also being completed (i.e.long
Returns the absolute nano time when the request got logically completed.long
Returns the request latency once logically completed (includes potential "inner" operations like observe calls).request()
int
long
serverLatency
(long serverLatency) long
long
Methods inherited from class com.couchbase.client.core.CoreContext
alternateAddress, alternateAddress, authenticator, core, environment, id
Methods inherited from class com.couchbase.client.core.cnc.AbstractContext
exportAsMap, exportAsString, toString
-
Constructor Details
-
RequestContext
-
RequestContext
@Internal public RequestContext(@Nullable Core core, long contextId, CoreEnvironment environment, Authenticator authenticator, Request<? extends Response> request)
-
-
Method Details
-
dispatchLatency
Returns the duration of the dispatch phase if set.- Returns:
- the duration of the dispatch phase.
-
dispatchLatency
Allows to set the dispatch duration of the request.- Parameters:
dispatchLatency
- the duration.
-
totalDispatchLatency
public long totalDispatchLatency() -
totalServerLatency
public long totalServerLatency() -
encodeLatency
-
encodeLatency
-
lastChannelId
-
lastChannelId
-
serverLatency
-
serverLatency
-
logicallyComplete
Signals that this request is completed fully, including streaming sections or logical sub-requests also being completed (i.e. observe polling).- Parameters:
err
- if non-null, will be recorded onto the span (if present).
-
logicallyComplete
-
retryAttempts
public int retryAttempts() -
retryReasons
-
lastRetryDuration
-
logicallyCompletedAt
public long logicallyCompletedAt()Returns the absolute nano time when the request got logically completed. -
logicalRequestLatency
public long logicalRequestLatency()Returns the request latency once logically completed (includes potential "inner" operations like observe calls). -
incrementRetryAttempts
@Internal public RequestContext incrementRetryAttempts(Duration lastRetryDuration, RetryReason reason) -
lastDispatchedTo
-
lastDispatchedToNode
-
lastDispatchedTo
-
lastDispatchedToNode
-
lastDispatchedFrom
-
lastDispatchedFrom
-
clientContext
Returns the custom user payload of this request.- Returns:
- the payload if set.
-
clientContext
Allows to set a custom payload for this request.- Parameters:
clientContext
- the payload to set.
-
request
-
injectExportableParams
Description copied from class:AbstractContext
This method needs to be implemented by the actual context implementations to inject the params they need for exporting.- Overrides:
injectExportableParams
in classCoreContext
- Parameters:
input
- pass exportable params in here.
-
cancel
Allows to cancel the attachedRequest
from anywhere in the code.If the operation is already completed (either successfully or failed) this is an operation without side-effect.
-