Class PoolEntry<T,C extends ModalCloseable>

java.lang.Object
org.apache.hc.core5.pool.PoolEntry<T,C>
Type Parameters:
T - the route type that represents the opposite endpoint of a pooled connection.
C - the connection type.

public final class PoolEntry<T,C extends ModalCloseable> extends Object
Pool entry containing a pool connection object along with its route.

The connection assigned to this pool entry may have an expiration time and also have an object representing a connection state (usually a security principal or a unique token identifying the user whose credentials have been used while establishing the connection).

Since:
4.2
  • Field Details

    • route

      private final T route
    • timeToLive

      private final TimeValue timeToLive
    • connRef

      private final AtomicReference<C extends ModalCloseable> connRef
    • disposalCallback

      private final DisposalCallback<C extends ModalCloseable> disposalCallback
    • currentTimeSupplier

      private final Supplier<Long> currentTimeSupplier
    • state

      private volatile Object state
    • created

      private volatile long created
    • updated

      private volatile long updated
    • expiryDeadline

      private volatile Deadline expiryDeadline
    • validityDeadline

      private volatile Deadline validityDeadline
  • Constructor Details

    • PoolEntry

      PoolEntry(T route, TimeValue timeToLive, DisposalCallback<C> disposalCallback, Supplier<Long> currentTimeSupplier)
    • PoolEntry

      PoolEntry(T route, TimeValue timeToLive, Supplier<Long> currentTimeSupplier)
    • PoolEntry

      public PoolEntry(T route, TimeValue timeToLive, DisposalCallback<C> disposalCallback)
      Creates new PoolEntry instance.
      Parameters:
      route - route to the opposite endpoint.
      timeToLive - maximum time to live. May be zero if the connection does not have an expiry deadline.
      disposalCallback - callback invoked before connection disposal.
    • PoolEntry

      public PoolEntry(T route, TimeValue timeToLive)
      Creates new PoolEntry instance.
      Parameters:
      route - route to the opposite endpoint.
      timeToLive - maximum time to live. May be zero if the connection does not have an expiry deadline.
    • PoolEntry

      public PoolEntry(T route)
  • Method Details

    • getCurrentTime

      long getCurrentTime()
    • getRoute

      public T getRoute()
    • getConnection

      public C getConnection()
    • getValidityDeadline

      public Deadline getValidityDeadline()
      Since:
      5.0
    • getState

      public Object getState()
    • getCreated

      public long getCreated()
      Since:
      5.2
    • getUpdated

      public long getUpdated()
    • getExpiryDeadline

      public Deadline getExpiryDeadline()
    • hasConnection

      public boolean hasConnection()
      Since:
      5.0
    • assignConnection

      public void assignConnection(C conn)
      Since:
      5.0
    • discardConnection

      public void discardConnection(CloseMode closeMode)
      Since:
      5.0
    • updateExpiry

      public void updateExpiry(TimeValue expiryTime)
      Since:
      5.0
    • updateState

      public void updateState(Object state)
      Since:
      5.0
    • toString

      public String toString()
      Overrides:
      toString in class Object