Class StrictConnPool<T,​C extends ModalCloseable>

    • Method Detail

      • isShutdown

        public boolean isShutdown()
      • close

        public void close​(CloseMode closeMode)
        Description copied from interface: ModalCloseable
        Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.
        Specified by:
        close in interface ModalCloseable
        Parameters:
        closeMode - How to close the receiver.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • lease

        public java.util.concurrent.Future<PoolEntry<T,​C>> lease​(T route,
                                                                       java.lang.Object state,
                                                                       Timeout requestTimeout,
                                                                       FutureCallback<PoolEntry<T,​C>> callback)
        Description copied from interface: ConnPool
        Attempts to lease a connection for the given route and with the given state from the pool.

        Please note the connection request can get automatically cancelled by the pool in case of a request timeout.

        Specified by:
        lease in interface ConnPool<T,​C extends ModalCloseable>
        Parameters:
        route - route of the connection.
        state - arbitrary object that represents a particular state (usually a security principal or a unique token identifying the user whose credentials have been used while establishing the connection). May be null.
        requestTimeout - request timeout. In case of a timeout the request can get automatically cancelled by the pool.
        callback - operation completion callback.
        Returns:
        future for a leased pool entry.
      • lease

        public java.util.concurrent.Future<PoolEntry<T,​C>> lease​(T route,
                                                                       java.lang.Object state)
      • release

        public void release​(PoolEntry<T,​C> entry,
                            boolean reusable)
        Description copied from interface: ConnPool
        Releases the pool entry back to the pool.
        Specified by:
        release in interface ConnPool<T,​C extends ModalCloseable>
        Parameters:
        entry - pool entry leased from the pool
        reusable - flag indicating whether or not the released connection is in a consistent state and is safe for further use.
      • processPendingRequests

        private void processPendingRequests()
      • processNextPendingRequest

        private void processNextPendingRequest()
      • fireCallbacks

        private void fireCallbacks()
      • validatePendingRequests

        public void validatePendingRequests()
      • getMax

        private int getMax​(T route)
      • getRoutes

        public java.util.Set<T> getRoutes()
        Returns snapshot of all knows routes
        Specified by:
        getRoutes in interface ConnPoolControl<T>
        Since:
        4.4
      • enumAvailable

        public void enumAvailable​(Callback<PoolEntry<T,​C>> callback)
        Enumerates all available connections.
        Since:
        4.3
      • enumLeased

        public void enumLeased​(Callback<PoolEntry<T,​C>> callback)
        Enumerates all leased connections.
        Since:
        4.3
      • purgePoolMap

        private void purgePoolMap()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object