Package one.nio.pool

Class Pool<T>

All Implemented Interfaces:
Closeable, Serializable, AutoCloseable, Cloneable, Iterable<T>, Collection<T>, Deque<T>, List<T>, Queue<T>
Direct Known Subclasses:
SocketPool

public abstract class Pool<T> extends LinkedList<T> implements Closeable
See Also:
  • Field Details

    • closed

      protected boolean closed
    • keepEmpty

      protected boolean keepEmpty
    • fifo

      protected boolean fifo
    • initialCount

      protected int initialCount
    • createdCount

      protected int createdCount
    • maxCount

      protected int maxCount
    • timeout

      protected int timeout
    • timeouts

      protected int timeouts
    • waitingThreads

      protected int waitingThreads
  • Constructor Details

    • Pool

      protected Pool(int initialCount, int maxCount, int timeout)
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • name

      public String name()
    • isClosed

      public boolean isClosed()
    • createObject

      public abstract T createObject() throws PoolException
      Throws:
      PoolException
    • destroyObject

      public void destroyObject(T object)
    • borrowObject

      public final T borrowObject() throws PoolException, InterruptedException
      Throws:
      PoolException
      InterruptedException
    • returnObject

      public final void returnObject(T object)
    • invalidateObject

      public final void invalidateObject(T object)
    • invalidateAll

      public final void invalidateAll()
    • initialize

      protected final void initialize()