public class RequestContext extends CoreContext
Request
.Context.ExportFormat
Constructor and Description |
---|
RequestContext(CoreContext ctx,
Request<? extends Response> request)
Creates a new
RequestContext . |
Modifier and Type | Method and Description |
---|---|
RequestContext |
cancel()
Allows to cancel the attached
Request from anywhere in the code. |
Map<String,Object> |
clientContext()
Returns the custom user payload of this request.
|
RequestContext |
clientContext(Map<String,Object> clientContext)
Allows to set a custom payload for this request.
|
long |
dispatchLatency()
Returns the duration of the dispatch phase if set.
|
RequestContext |
dispatchLatency(long dispatchLatency)
Allows to set the dispatch duration of the request.
|
long |
encodeLatency() |
RequestContext |
encodeLatency(long encodeLatency) |
RequestContext |
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.
|
String |
lastChannelId() |
RequestContext |
lastChannelId(String lastChannelId) |
HostAndPort |
lastDispatchedFrom() |
RequestContext |
lastDispatchedFrom(HostAndPort lastDispatchedFrom) |
HostAndPort |
lastDispatchedTo() |
RequestContext |
lastDispatchedTo(HostAndPort lastDispatchedTo) |
Duration |
lastRetryDuration() |
RequestContext |
logicallyComplete()
Signals that this request is completed fully, including streaming sections or logical sub-requests also being
completed (i.e.
|
long |
logicallyCompletedAt()
Returns the absolute nano time when the request got logically completed.
|
long |
logicalRequestLatency()
Returns the request latency once logically completed (includes potential "inner" operations like observe
calls).
|
Request<? extends Response> |
request() |
int |
retryAttempts() |
Set<RetryReason> |
retryReasons() |
long |
serverLatency() |
RequestContext |
serverLatency(long serverLatency) |
alternateAddress, alternateAddress, authenticator, core, environment, id
exportAsString, toString
@Stability.Internal public RequestContext(CoreContext ctx, Request<? extends Response> request)
RequestContext
.ctx
- the core context.request
- the linked request.@Stability.Volatile public long dispatchLatency()
@Stability.Internal public RequestContext dispatchLatency(long dispatchLatency)
dispatchLatency
- the duration.@Stability.Volatile public long encodeLatency()
@Stability.Internal public RequestContext encodeLatency(long encodeLatency)
@Stability.Volatile public String lastChannelId()
@Stability.Internal public RequestContext lastChannelId(String lastChannelId)
@Stability.Volatile public long serverLatency()
@Stability.Internal public RequestContext serverLatency(long serverLatency)
@Stability.Internal public RequestContext logicallyComplete()
public int retryAttempts()
public Set<RetryReason> retryReasons()
public Duration lastRetryDuration()
public long logicallyCompletedAt()
public long logicalRequestLatency()
@Stability.Internal public RequestContext incrementRetryAttempts(Duration lastRetryDuration, RetryReason reason)
public HostAndPort lastDispatchedTo()
@Stability.Internal public RequestContext lastDispatchedTo(HostAndPort lastDispatchedTo)
public HostAndPort lastDispatchedFrom()
@Stability.Internal public RequestContext lastDispatchedFrom(HostAndPort lastDispatchedFrom)
public Map<String,Object> clientContext()
@Stability.Internal public RequestContext clientContext(Map<String,Object> clientContext)
clientContext
- the payload to set.public void injectExportableParams(Map<String,Object> input)
AbstractContext
injectExportableParams
in class CoreContext
input
- pass exportable params in here.@Stability.Uncommitted public RequestContext cancel()
Request
from anywhere in the code.
If the operation is already completed (either successfully or failed) this is an operation without side-effect.
Copyright © 2020 Couchbase, Inc.. All rights reserved.