Class PooledVinciClient


  • public class PooledVinciClient
    extends Object
    Maintains a pool of connections to a given service and allows thread-safe querying of that service. This provides a set of sendAndReceive methods with signatures equivalent to those in VinciClient, but unlike VinciClient, the methods can be invoked concurrently by multiple threads.
    • Constructor Detail

      • PooledVinciClient

        public PooledVinciClient​(String serviceName,
                                 int maxPoolSize)
        Create a PooledVinciClient that will establish at most maxPoolSize connections to the designated service.
        Parameters:
        serviceName - -
        maxPoolSize - -
    • Method Detail

      • setContext

        public void setContext​(VinciContext context)
        Set a VinciContext that will be used by this PooledVinciClient instead of the default global context.
        Parameters:
        context - -
      • setConnectTimeout

        public void setConnectTimeout​(int connectTimeoutMillis)
        Set a connect timeout that will be used in place of BaseClient.DEFAULT_CONNECT_TIMEOUT
        Parameters:
        connectTimeoutMillis - -
      • setSocketTimeout

        public void setSocketTimeout​(int socketTimeoutMillis)
        Set a socket timeout that will be used in place of BaseClient.DEFAULT_SOCKET_TIMEOUT
        Parameters:
        socketTimeoutMillis - -
      • setTransportableFactory

        public void setTransportableFactory​(TransportableFactory factory)
        Set a transportable factory that will be used in place of the VinciFrame factory.
        Parameters:
        factory - -
      • getServiceName

        public String getServiceName()
        Get the service name to which this client connects.
        Returns:
        -
      • close

        public void close​(boolean wait)
        Close this pooled client. Blocked requests will return IOException, as will any requests following the invocation of this method. Once a pooled client is closed it cannot be reused.
        Parameters:
        wait - If true, this method will block until all in-progress requests have completed, otherwise this method will return immediately (though in progress requests will still be allowed to complete)