Class AbstractConnectionPool

All Implemented Interfaces:
Closeable, AutoCloseable, ConnectionPool, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Sweeper.Sweepable
Direct Known Subclasses:
DuplexConnectionPool, MultiplexConnectionPool

@ManagedObject @Deprecated(since="2021-05-27") public abstract class AbstractConnectionPool extends ContainerLifeCycle implements ConnectionPool, Dumpable, Sweeper.Sweepable
Deprecated.
  • Method Details

    • preCreateConnections

      public CompletableFuture<Void> preCreateConnections(int connectionCount)
      Deprecated.
      Description copied from interface: ConnectionPool
      Optionally pre-create up to connectionCount connections so they are immediately ready for use.
      Specified by:
      preCreateConnections in interface ConnectionPool
      Parameters:
      connectionCount - the number of connections to pre-start.
    • getMaxDuration

      @ManagedAttribute("The maximum duration in milliseconds a connection can be used for before it gets closed") public long getMaxDuration()
      Deprecated.

      Get the max usage duration in milliseconds of the pool's connections. Values 0 and negative mean that there is no limit.

      This only guarantees that a connection cannot be acquired after the configured duration elapses, so that is only enforced when acquire() is called. If a pool stays completely idle for a duration longer than the value returned by this method, the max duration will not be enforced. It's up to the idle timeout mechanism (see HttpClient.getIdleTimeout()) to handle closing idle connections.

    • setMaxDuration

      public void setMaxDuration(long maxDurationInMs)
      Deprecated.
    • getActiveConnectionCount

      @ManagedAttribute(value="The number of active connections", readonly=true) public int getActiveConnectionCount()
      Deprecated.
    • getIdleConnectionCount

      @ManagedAttribute(value="The number of idle connections", readonly=true) public int getIdleConnectionCount()
      Deprecated.
    • getMaxConnectionCount

      @ManagedAttribute(value="The max number of connections", readonly=true) public int getMaxConnectionCount()
      Deprecated.
    • getConnectionCount

      @ManagedAttribute(value="The number of connections", readonly=true) public int getConnectionCount()
      Deprecated.
    • getPendingCount

      @ManagedAttribute(value="The number of pending connections", readonly=true) @Deprecated public int getPendingCount()
      Deprecated.
      Returns:
      the number of pending connections
    • getPendingConnectionCount

      @ManagedAttribute(value="The number of pending connections", readonly=true) public int getPendingConnectionCount()
      Deprecated.
    • isEmpty

      public boolean isEmpty()
      Deprecated.
      Specified by:
      isEmpty in interface ConnectionPool
      Returns:
      whether this ConnectionPool has no open connections
    • isClosed

      @ManagedAttribute("Whether this pool is closed") public boolean isClosed()
      Deprecated.
      Specified by:
      isClosed in interface ConnectionPool
      Returns:
      whether this ConnectionPool has been closed
      See Also:
    • isMaximizeConnections

      @ManagedAttribute("Whether the pool tries to maximize the number of connections used") public boolean isMaximizeConnections()
      Deprecated.
    • setMaximizeConnections

      public void setMaximizeConnections(boolean maximizeConnections)
      Deprecated.

      Sets whether the number of connections should be maximized.

      Parameters:
      maximizeConnections - whether the number of connections should be maximized
    • acquire

      public Connection acquire()
      Deprecated.
      Description copied from interface: ConnectionPool

      Returns an idle connection, if available, or schedules the opening of a new connection and returns null.

      Specified by:
      acquire in interface ConnectionPool
      Returns:
      an available connection, or null
    • isActive

      public boolean isActive(Connection connection)
      Deprecated.
      Specified by:
      isActive in interface ConnectionPool
      Parameters:
      connection - the connection to test
      Returns:
      whether the given connection is currently in use
    • release

      public boolean release(Connection connection)
      Deprecated.
      Description copied from interface: ConnectionPool

      Returns the given connection, previously obtained via ConnectionPool.acquire(), back to this ConnectionPool.

      Specified by:
      release in interface ConnectionPool
      Parameters:
      connection - the connection to release
      Returns:
      true if the connection has been released, false if the connection should be closed
    • remove

      public boolean remove(Connection connection)
      Deprecated.
      Description copied from interface: ConnectionPool

      Removes the given connection from this ConnectionPool.

      Specified by:
      remove in interface ConnectionPool
      Parameters:
      connection - the connection to remove
      Returns:
      true if the connection was removed from this ConnectionPool
    • getIdleConnections

      @Deprecated public Queue<Connection> getIdleConnections()
      Deprecated.
      Relying on this method indicates a reliance on the implementation details.
      Returns:
      an unmodifiable queue working as a view of the idle connections.
    • getActiveConnections

      @Deprecated public Collection<Connection> getActiveConnections()
      Deprecated.
      Relying on this method indicates a reliance on the implementation details.
      Returns:
      an unmodifiable collection working as a view of the active connections.
    • close

      public void close()
      Deprecated.
      Description copied from interface: ConnectionPool
      Closes this ConnectionPool.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface ConnectionPool
      See Also:
    • dump

      public void dump(Appendable out, String indent) throws IOException
      Deprecated.
      Description copied from interface: Dumpable
      Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
      Specified by:
      dump in interface Dumpable
      Overrides:
      dump in class ContainerLifeCycle
      Parameters:
      out - The appendable to dump to
      indent - The indent to apply after any new lines.
      Throws:
      IOException - if unable to write to Appendable
    • sweep

      public boolean sweep()
      Deprecated.
      Specified by:
      sweep in interface Sweeper.Sweepable
      Returns:
      whether this resource should be swept
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class AbstractLifeCycle