Interface ConnectionPool


  • public interface ConnectionPool
    A Connection pool interface that pools a list of connections, does connection management and connection cleanup. A checkoutConnection should be followed by a checkInConnection or destroyConnection. The pool is also responsible to close and delete connections on shutdown. This includes connection that are live and idle.
    • Method Detail

      • start

        void start()
        Starts the connection pool.
      • shutdown

        void shutdown()
        Shutsdown the connection pool. This also includes cleaning up all idle and active connections
      • checkOutConnection

        ConnectedChannel checkOutConnection​(java.lang.String host,
                                            Port port,
                                            long timeout)
                                     throws java.io.IOException,
                                            java.lang.InterruptedException,
                                            ConnectionPoolTimeoutException
        Returns a connected channel that represents the give host and port. If no connection is available, this method blocks for the timeout specified
        Parameters:
        host - The remote host to which a connection is required
        port - The remote to which a connection is required
        timeout - The time up to which to wait to get a connection
        Returns:
        The connected channel that represents the given host and port.
        Throws:
        java.io.IOException
        java.lang.InterruptedException
        ConnectionPoolTimeoutException
      • checkInConnection

        void checkInConnection​(ConnectedChannel connectedChannel)
        The connected channel that needs to be put back into the pool after a successful usage
        Parameters:
        connectedChannel - The channel to check in
      • destroyConnection

        void destroyConnection​(ConnectedChannel connectedChannel)
        The connected channel that needs to be destroyed/disconnected after an error
        Parameters:
        connectedChannel - The channel to destroy/disconnect