Class RequestFutureManager

  • All Implemented Interfaces:
    AutoCloseable

    public class RequestFutureManager
    extends Object
    implements AutoCloseable
    Keeps track of submitted requests, finishing them by timeout and allowing asynchronous request processing
    • Constructor Detail

      • RequestFutureManager

        public RequestFutureManager​(TarantoolClientConfig config,
                                    ScheduledExecutorService timeoutScheduler)
        Basic constructor.
        Parameters:
        config - tarantool client configuration
        timeoutScheduler - scheduled executor for handling request timeouts
    • Method Detail

      • submitRequest

        public <T> CompletableFuture<T> submitRequest​(TarantoolRequest request,
                                                      MessagePackValueMapper resultMapper)
        Submit a request ID for tracking. Provides a CompletableFuture for tracking the request completion. The request timeout is taken from the client configuration
        Type Parameters:
        T - target response body type
        Parameters:
        request - request to Tarantool server
        resultMapper - result message entity-to-object mapper
        Returns:
        CompletableFuture that completes when a response is received from Tarantool server
      • submitRequest

        public <T> CompletableFuture<T> submitRequest​(TarantoolRequest request,
                                                      int requestTimeout,
                                                      MessagePackValueMapper resultMapper)
        Submit a request ID for tracking. Provides a CompletableFuture for tracking the request completion. The request timeout is taken from the client configuration
        Type Parameters:
        T - target response body type
        Parameters:
        request - request to Tarantool server
        requestTimeout - timeout after which the request will be automatically failed, milliseconds
        resultMapper - result message entity-to-object mapper
        Returns:
        CompletableFuture that completes when a response is received from Tarantool server
      • getRequest

        public TarantoolRequestMetadata getRequest​(Long requestId)
        Get a request me instance bound to the passed request ID
        Parameters:
        requestId - ID of a request to Tarantool server (sync ID)
        Returns:
        CompletableFuture that completes when a response is received from Tarantool server