Class ConnectionPool


  • public class ConnectionPool
    extends java.lang.Object
    The Class ConnectionPool.
    • Constructor Detail

      • ConnectionPool

        public ConnectionPool​(int maxPoolSize,
                              int initialPoolSize,
                              java.net.InetSocketAddress inetAddr,
                              java.util.List<TransformerFactory> transformerFactories)
        Instantiates a new connection pool.
        Parameters:
        maxPoolSize - the max pool size
        initialPoolSize - the initial pool size
        inetAddr - the IP Socket Address
        transformerFactories - factories for creating request transformers
    • Method Detail

      • getConnection

        public Connection getConnection()
                                 throws java.lang.InterruptedException
        returns a connection from the pool
        Throws:
        java.lang.InterruptedException
      • surrenderConnection

        public void surrenderConnection​(Connection s)
        Surrender connection.
        Parameters:
        s - the s
      • isHealthy

        public boolean isHealthy()
        Checks if is healthy.
        Returns:
        true, if is healthy
      • getInetSocketAddress

        public java.net.InetSocketAddress getInetSocketAddress()
        The IP Socket Address.
      • getMaxPoolSize

        public int getMaxPoolSize()
        Maximum number of connections that the pool can have.
      • getInitialPoolSize

        public int getInitialPoolSize()
        Number of connections that should be created initially.
      • getCurrentPoolSize

        public int getCurrentPoolSize()
        Number of connections generated so far.
      • getActiveConnections

        public int getActiveConnections()
        Returns the number of currently active connections.