Class AbstractRequest<T>
java.lang.Object
java.util.concurrent.CompletableFuture<T>
org.infinispan.remoting.transport.AbstractRequest<T>
- All Implemented Interfaces:
- Callable<Void>,- CompletionStage<T>,- Future<T>,- Request<T>
- Direct Known Subclasses:
- MultiTargetRequest,- SingleSiteRequest,- SingleTargetRequest
public abstract class AbstractRequest<T>
extends CompletableFuture<T>
implements Callable<Void>, Request<T>
A remote invocation request.
 
Thread-safety: This class and its sub-classes are thread-safe. They use the ResponseCollector's monitor
 for synchronization, so that collectors usually don't need any explicit synchronization.
- Since:
- 9.1
- Author:
- Dan Berindei
- 
Nested Class SummaryNested classes/interfaces inherited from class java.util.concurrent.CompletableFutureCompletableFuture.AsynchronousCompletionTask
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final RequestRepositoryprotected final longprotected final ResponseCollector<T>Fields inherited from interface org.infinispan.remoting.transport.impl.RequestNO_REQUEST_ID
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractRequest(long requestId, ResponseCollector<T> responseCollector, RequestRepository repository) 
- 
Method SummaryModifier and TypeMethodDescriptionfinal Voidcall()booleancancel(boolean mayInterruptIfRunning) voidComplete the request with an exception and release its resources.booleanbooleanfinal longlongprotected abstract voidCalled when the timeout task scheduled withsetTimeout(ScheduledExecutorService, long, TimeUnit)expires.voidsetTimeout(ScheduledExecutorService timeoutExecutor, long timeout, TimeUnit unit) Schedule a timeout task on the given executor, and complete the request with aTimeoutExceptionwhen the task runs.Methods inherited from class java.util.concurrent.CompletableFutureacceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, completeAsync, completeAsync, completedFuture, completedStage, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsyncMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.CompletionStageacceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsyncMethods inherited from interface org.infinispan.remoting.transport.impl.RequestonNewView, onResponse
- 
Field Details- 
responseCollector
- 
requestIdprotected final long requestId
- 
repository
 
- 
- 
Constructor Details- 
AbstractRequestprotected AbstractRequest(long requestId, ResponseCollector<T> responseCollector, RequestRepository repository) 
 
- 
- 
Method Details- 
onTimeoutprotected abstract void onTimeout()Called when the timeout task scheduled withsetTimeout(ScheduledExecutorService, long, TimeUnit)expires.
- 
getRequestIdpublic final long getRequestId()- Specified by:
- getRequestIdin interface- Request<T>
- Returns:
- The unique request id.
 
- 
setTimeoutSchedule a timeout task on the given executor, and complete the request with aTimeoutExceptionwhen the task runs. If a timeout task was already registered with this request, it is cancelled.
- 
cancelDescription copied from interface:RequestComplete the request with an exception and release its resources.
- 
complete- Overrides:
- completein class- CompletableFuture<T>
 
- 
completeExceptionally- Overrides:
- completeExceptionallyin class- CompletableFuture<T>
 
- 
cancelpublic boolean cancel(boolean mayInterruptIfRunning) 
- 
call
- 
getTimeoutMspublic long getTimeoutMs()
 
-