Interface Poolable<T extends Poolable<T>>

Type Parameters:
T - the type of poolable
All Known Subinterfaces:
Connection
All Known Implementing Classes:
AbstractConnection, LoopbackConnection, TcpConnection

public interface Poolable<T extends Poolable<T>>
A resource that can be managed by a Pool.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the resource.
    Gets the pool.
    int
    Gets the unique ID within the pool.
    boolean
    Returns whether the resource is open and usable.
    void
    setPool(Pool<T> pool)
    Sets the pool.
    void
    setPoolId(int poolId)
    Sets the unique ID within the pool.
    The ID is set when the poolable is retrieved from the pool.
  • Method Details

    • setPool

      void setPool(Pool<T> pool)
      Sets the pool.
      Parameters:
      pool - the pool, null if removed from the pool
    • getPool

      Pool<T> getPool()
      Gets the pool.
      Returns:
      the pool, null if removed from the pool
    • setPoolId

      void setPoolId(int poolId)
      Sets the unique ID within the pool.
      The ID is set when the poolable is retrieved from the pool.
      Parameters:
      poolId - the pool ID (0 if not lent, > 0 if lent, -1 if removed from pool)
    • getPoolId

      int getPoolId()
      Gets the unique ID within the pool.
      Returns:
      the pool ID (0 if not lent, > 0 if lent, -1 if removed from pool)
    • isOpen

      boolean isOpen()
      Returns whether the resource is open and usable.
      Returns:
      true if open
    • close

      void close()
      Closes the resource.