@Stability.Volatile public class ProtostellarBaseRequest extends Object implements Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
Request, create one dynamically.| Constructor and Description |
|---|
ProtostellarBaseRequest(CoreProtostellar core,
ProtostellarRequest<?> request) |
| Modifier and Type | Method and Description |
|---|---|
long |
absoluteTimeout()
The absolute timestamp when the request should time out.
|
void |
cancel(CancellationReason reason,
Function<Throwable,Throwable> exceptionTranslator)
Cancels this request, allowing the caller to customize the exception.
|
CancellationReason |
cancellationReason()
If the request is
Request.cancelled(), this returns the reason why. |
boolean |
cancelled()
Allows to check if this request has been cancelled before it got a chance
to be either failed or succeeded.
|
boolean |
completed()
Allows to check if this request is completed already.
|
RequestContext |
context()
If attached, returns the context for this request.
|
long |
createdAt()
Holds the nanoTime when the request got created.
|
void |
fail(Throwable error)
Fails this request and completes it.
|
boolean |
failed()
Allows to check if this request has been completed but with an exception.
|
long |
id()
Holds a unique ID for each request that is assigned automatically.
|
RequestSpan |
requestSpan()
Holds the internal span for this request.
|
CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse> |
response()
Holds the response which eventually completes.
|
RetryStrategy |
retryStrategy()
The retry strategy for this particular request.
|
Map<String,Object> |
serviceContext()
Returns contextual information for each individual service.
|
ServiceType |
serviceType()
The service type of this request.
|
void |
succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)
Completes this request successfully.
|
boolean |
succeeded()
Allows to check if this request has been successfully completed.
|
Duration |
timeout()
Returns the timeout for this request.
|
boolean |
timeoutElapsed()
Returns true if the timeout elapsed.
|
void |
timeoutRegistration(com.couchbase.client.core.deps.io.netty.util.Timeout registration)
Sets the timeout registration used to cancel when complete.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbucket, cancel, idempotent, name, operationId, target@Stability.Internal public ProtostellarBaseRequest(CoreProtostellar core, ProtostellarRequest<?> request)
public long id()
Requestpublic CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse> response()
Requestpublic void succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)
Requestpublic void fail(Throwable error)
Requestpublic void cancel(CancellationReason reason, Function<Throwable,Throwable> exceptionTranslator)
Requestpublic void timeoutRegistration(com.couchbase.client.core.deps.io.netty.util.Timeout registration)
RequesttimeoutRegistration in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>registration - the registration for the timeout timer.public RequestContext context()
Requestpublic Duration timeout()
Requestpublic boolean timeoutElapsed()
RequesttimeoutElapsed in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>public boolean completed()
Requestpublic boolean succeeded()
Requestpublic boolean failed()
Requestpublic boolean cancelled()
Requestpublic CancellationReason cancellationReason()
RequestRequest.cancelled(), this returns the reason why.cancellationReason in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>public ServiceType serviceType()
RequestCan be null if this is a 'virtual service' (e.g. transactions), which don't map 1:1 to a particular cluster service, but need to integrate into various codepaths that are built around ServiceType such as ThresholdLoggingTracer. Virtual requests must not be sent into core at present, as there is limited support for them.
serviceType in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>public Map<String,Object> serviceContext()
RequestserviceContext in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>public RetryStrategy retryStrategy()
RequestretryStrategy in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>public RequestSpan requestSpan()
RequestrequestSpan in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>public long createdAt()
Requestpublic long absoluteTimeout()
RequestabsoluteTimeout in interface Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>Copyright © 2024 Couchbase, Inc.. All rights reserved.