Class AbstractRequest<T>

  • All Implemented Interfaces:
    Callable<Void>, CompletionStage<T>, Future<T>, org.infinispan.remoting.transport.impl.Request<T>
    Direct Known Subclasses:
    org.infinispan.remoting.transport.impl.MultiTargetRequest, SingleSiteRequest

    public abstract class AbstractRequest<T>
    extends CompletableFuture<T>
    implements Callable<Void>, org.infinispan.remoting.transport.impl.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
    • Field Detail

      • requestId

        protected final long requestId
      • repository

        protected final org.infinispan.remoting.transport.impl.RequestRepository repository
    • Constructor Detail

      • AbstractRequest

        protected AbstractRequest​(long requestId,
                                  ResponseCollector<T> responseCollector,
                                  org.infinispan.remoting.transport.impl.RequestRepository repository)
    • Method Detail

      • getRequestId

        public final long getRequestId()
        Specified by:
        getRequestId in interface org.infinispan.remoting.transport.impl.Request<T>
        Returns:
        The unique request id.
      • setTimeout

        public void setTimeout​(ScheduledExecutorService timeoutExecutor,
                               long timeout,
                               TimeUnit unit)
        Schedule a timeout task on the given executor, and complete the request with a TimeoutException when the task runs. If a timeout task was already registered with this request, it is cancelled.
      • cancel

        public void cancel​(Exception exception)
        Description copied from interface: org.infinispan.remoting.transport.impl.Request
        Complete the request with an exception and release its resources.
        Specified by:
        cancel in interface org.infinispan.remoting.transport.impl.Request<T>