Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.pool
Class PoolEntry<T,C>

    java.lang.Object
      org.apache.http.pool.PoolEntry<T,C>

Type Parameters:
  `T` - the route type that represents the opposite endpoint of a pooled connection.
  `C` - the connection type.

Direct Known Subclasses:
  BasicNIOPoolEntry, BasicPoolEntry

    @Contract(threading=SAFE_CONDITIONAL)
    public abstract class PoolEntry<T,C>

extends Object

Pool entry containing a pool connection object along with its route.

The connection contained by the pool entry may have an expiration time which can be either set upon construction time or updated with the `updateExpiry(long, TimeUnit)`.

Pool entry may also have an object associated with it that represents 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

Constructor Summary
`PoolEntry(String id, T route, C conn)` Creates new `PoolEntry` instance without an expiry deadline.
`PoolEntry(String id, T route, C conn, long timeToLive, TimeUnit timeUnit)` Creates new `PoolEntry` instance.

Method Summary
`abstract void` | `close()` Invalidates the pool entry and closes the pooled connection associated with it.
`C` | `getConnection()`
`long` | `getCreated()`
`long` | `getExpiry()`
`String` | `getId()`
`T` | `getRoute()`
`Object` | `getState()`
`long` | `getUpdated()`
`long` | `getValidityDeadline()`
`long` | `getValidUnit()` Deprecated. use `getValidityDeadline()`
`abstract boolean` | `isClosed()` Returns `true` if the pool entry has been invalidated.
`boolean` | `isExpired(long now)`
`void` | `setState(Object state)`
`String` | `toString()`
`void` | `updateExpiry(long time, TimeUnit timeUnit)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PoolEntry

    public PoolEntry(String id,
                     T route,
                     C conn,
                     long timeToLive,
                     TimeUnit timeUnit)

  Creates new `PoolEntry` instance.

  Parameters:
    `id` - unique identifier of the pool entry. May be `null`.
    `route` - route to the opposite endpoint.
    `conn` - the connection.
    `timeToLive` - maximum time to live. May be zero if the connection does not have an expiry deadline.
    `timeUnit` - time unit.

### PoolEntry

    public PoolEntry(String id,
                     T route,
                     C conn)

  Creates new `PoolEntry` instance without an expiry deadline.

  Parameters:
    `id` - unique identifier of the pool entry. May be `null`.
    `route` - route to the opposite endpoint.
    `conn` - the connection.

Method Detail

### getId

    public String getId()

### getRoute

    public T getRoute()

### getConnection

    public C getConnection()

### getCreated

    public long getCreated()

### getValidityDeadline

    public long getValidityDeadline()

  Since:
    4.4

### getValidUnit

    @Deprecated
    public long getValidUnit()

  Deprecated. use `getValidityDeadline()`

### getState

    public Object getState()

### setState

    public void setState(Object state)

### getUpdated

    public long getUpdated()

### getExpiry

    public long getExpiry()

### updateExpiry

    public void updateExpiry(long time,
                             TimeUnit timeUnit)

### isExpired

    public boolean isExpired(long now)

### close

    public abstract void close()

  Invalidates the pool entry and closes the pooled connection associated with it.

### isClosed

    public abstract boolean isClosed()

  Returns `true` if the pool entry has been invalidated.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.