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 aRequest, create one dynamically.
-
-
Constructor Summary
Constructors Constructor Description ProtostellarBaseRequest(Core core, ProtostellarRequest<?> request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longabsoluteTimeout()The absolute timestamp when the request should time out.voidcancel(CancellationReason reason, Function<Throwable,Throwable> exceptionTranslator)Cancels this request, allowing the caller to customize the exception.CancellationReasoncancellationReason()If the request isRequest.cancelled(), this returns the reason why.booleancancelled()Allows to check if this request has been cancelled before it got a chance to be either failed or succeeded.booleancompleted()Allows to check if this request is completed already.RequestContextcontext()If attached, returns the context for this request.longcreatedAt()Holds the nanoTime when the request got created.voidfail(Throwable error)Fails this request and completes it.booleanfailed()Allows to check if this request has been completed but with an exception.longid()Holds a unique ID for each request that is assigned automatically.RequestSpanrequestSpan()Holds the internal span for this request.CompletableFuture<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>response()Holds the response which eventually completes.RetryStrategyretryStrategy()The retry strategy for this particular request.Map<String,Object>serviceContext()Returns contextual information for each individual service.ServiceTypeserviceType()The service type of this request.voidsucceed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)Completes this request successfully.booleansucceeded()Allows to check if this request has been successfully completed.Durationtimeout()Returns the timeout for this request.booleantimeoutElapsed()Returns true if the timeout elapsed.voidtimeoutRegistration(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 Detail
-
ProtostellarBaseRequest
@Internal public ProtostellarBaseRequest(Core core, ProtostellarRequest<?> request)
-
-
Method Detail
-
id
public long id()
Description copied from interface:RequestHolds 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:RequestHolds the response which eventually completes.
-
succeed
public void succeed(com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse result)
Description copied from interface:RequestCompletes this request successfully.
-
fail
public void fail(Throwable error)
Description copied from interface:RequestFails this request and completes it.
-
cancel
public void cancel(CancellationReason reason, Function<Throwable,Throwable> exceptionTranslator)
Description copied from interface:RequestCancels 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:RequestSets the timeout registration used to cancel when complete.- Specified by:
timeoutRegistrationin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Parameters:
registration- the registration for the timeout timer.
-
context
public RequestContext context()
Description copied from interface:RequestIf attached, returns the context for this request.
-
timeout
public Duration timeout()
Description copied from interface:RequestReturns the timeout for this request.
-
timeoutElapsed
public boolean timeoutElapsed()
Description copied from interface:RequestReturns true if the timeout elapsed.- Specified by:
timeoutElapsedin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>
-
completed
public boolean completed()
Description copied from interface:RequestAllows to check if this request is completed already.
-
succeeded
public boolean succeeded()
Description copied from interface:RequestAllows to check if this request has been successfully completed.
-
failed
public boolean failed()
Description copied from interface:RequestAllows to check if this request has been completed but with an exception.
-
cancelled
public boolean cancelled()
Description copied from interface:RequestAllows to check if this request has been cancelled before it got a chance to be either failed or succeeded.
-
cancellationReason
public CancellationReason cancellationReason()
Description copied from interface:RequestIf the request isRequest.cancelled(), this returns the reason why.- Specified by:
cancellationReasonin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Returns:
- the cancellation reason if cancelled, null otherwise.
-
serviceType
public ServiceType serviceType()
Description copied from interface:RequestThe 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:
serviceTypein interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Returns:
- the service type for this request.
-
serviceContext
public Map<String,Object> serviceContext()
Description copied from interface:RequestReturns contextual information for each individual service.- Specified by:
serviceContextin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Returns:
- the service context.
-
retryStrategy
public RetryStrategy retryStrategy()
Description copied from interface:RequestThe retry strategy for this particular request.- Specified by:
retryStrategyin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Returns:
- the retry strategy for this request.
-
requestSpan
public RequestSpan requestSpan()
Description copied from interface:RequestHolds the internal span for this request.- Specified by:
requestSpanin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Returns:
- the internal span used for the request.
-
createdAt
public long createdAt()
Description copied from interface:RequestHolds the nanoTime when the request got created.
-
absoluteTimeout
public long absoluteTimeout()
Description copied from interface:RequestThe absolute timestamp when the request should time out.- Specified by:
absoluteTimeoutin interfaceRequest<com.couchbase.client.core.protostellar.ProtostellarBaseRequest.ProtostellarResponse>- Returns:
- the absolute timeout in nanoseconds.
-
-