Class ProtostellarBaseRequest
java.lang.Object
com.couchbase.client.core.protostellar.ProtostellarBaseRequest
- All Implemented Interfaces:
Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
@Volatile
public class ProtostellarBaseRequest
extends Object
implements Request<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
Where the public API requires a
Request
, create one dynamically.-
Constructor Summary
ConstructorDescriptionProtostellarBaseRequest
(CoreProtostellar core, ProtostellarRequest<?> request) -
Method Summary
Modifier and TypeMethodDescriptionlong
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.If the request isRequest.cancelled()
, this returns the reason why.boolean
Allows to check if this request has been cancelled before it got a chance to be either failed or succeeded.boolean
Allows to check if this request is completed already.context()
If attached, returns the context for this request.long
Holds the nanoTime when the request got created.void
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.Holds the internal span for this request.CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
response()
Holds the response which eventually completes.The retry strategy for this particular request.Returns contextual information for each individual service.The service type of this request.void
succeed
(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result) Completes this request successfully.boolean
Allows to check if this request has been successfully completed.timeout()
Returns the timeout for this request.boolean
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.couchbase.client.core.msg.Request
bucket, cancel, idempotent, name, operationId, target
-
Constructor Details
-
ProtostellarBaseRequest
-
-
Method Details
-
id
public long id()Description copied from interface:Request
Holds a unique ID for each request that is assigned automatically. -
response
public CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse> response()Description copied from interface:Request
Holds the response which eventually completes. -
succeed
public void succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result) Description copied from interface:Request
Completes this request successfully. -
fail
Description copied from interface:Request
Fails this request and completes it. -
cancel
Description copied from interface:Request
Cancels this request, allowing the caller to customize the exception. -
timeoutRegistration
public void timeoutRegistration(com.couchbase.client.core.deps.io.netty.util.Timeout registration) Description copied from interface:Request
Sets the timeout registration used to cancel when complete.- Specified by:
timeoutRegistration
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Parameters:
registration
- the registration for the timeout timer.
-
context
Description copied from interface:Request
If attached, returns the context for this request. -
timeout
Description copied from interface:Request
Returns the timeout for this request. -
timeoutElapsed
public boolean timeoutElapsed()Description copied from interface:Request
Returns true if the timeout elapsed.- Specified by:
timeoutElapsed
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
-
completed
public boolean completed()Description copied from interface:Request
Allows to check if this request is completed already. -
succeeded
public boolean succeeded()Description copied from interface:Request
Allows to check if this request has been successfully completed. -
failed
public boolean failed()Description copied from interface:Request
Allows to check if this request has been completed but with an exception. -
cancelled
public boolean cancelled()Description copied from interface:Request
Allows to check if this request has been cancelled before it got a chance to be either failed or succeeded. -
cancellationReason
Description copied from interface:Request
If the request isRequest.cancelled()
, this returns the reason why.- Specified by:
cancellationReason
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Returns:
- the cancellation reason if cancelled, null otherwise.
-
serviceType
Description copied from interface:Request
The service type of this request.Can 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.
- Specified by:
serviceType
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Returns:
- the service type for this request.
-
serviceContext
Description copied from interface:Request
Returns contextual information for each individual service.- Specified by:
serviceContext
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Returns:
- the service context.
-
retryStrategy
Description copied from interface:Request
The retry strategy for this particular request.- Specified by:
retryStrategy
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Returns:
- the retry strategy for this request.
-
requestSpan
Description copied from interface:Request
Holds the internal span for this request.- Specified by:
requestSpan
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Returns:
- the internal span used for the request.
-
createdAt
public long createdAt()Description copied from interface:Request
Holds the nanoTime when the request got created. -
absoluteTimeout
public long absoluteTimeout()Description copied from interface:Request
The absolute timestamp when the request should time out.- Specified by:
absoluteTimeout
in interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
- Returns:
- the absolute timeout in nanoseconds.
-