Interface Pool.Entry<E>

Type Parameters:
E - the type of the pooled objects
All Known Implementing Classes:
ConcurrentPool.ConcurrentEntry, Pool.Entry.Wrapper
Enclosing interface:
Pool<P>

public static interface Pool.Entry<E>

A Pool entry that holds metadata and a pooled object.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    A wrapper for Entry instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    enable(E pooled, boolean acquire)
    Enables this, previously reserved, Entry.
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    Releases this Entry to the Pool.
    boolean
    Removes this Entry from the Pool.
  • Method Details

    • enable

      boolean enable(E pooled, boolean acquire)

      Enables this, previously reserved, Entry.

      An entry returned from the Pool.reserve() method must be enabled with this method, once and only once, before it is usable by the pool.

      The entry may be enabled and not acquired, in which case it is immediately available to be acquired, potentially by another thread; or it can be enabled and acquired atomically so that no other thread can acquire it, although the acquire may still fail if the pool has been terminated.

      Parameters:
      pooled - the pooled object for this Entry
      acquire - whether this Entry should be atomically enabled and acquired
      Returns:
      whether this Entry was enabled
      Throws:
      IllegalStateException - if this Entry was already enabled
    • getPooled

      E getPooled()
      Returns:
      the pooled object
    • release

      boolean release()

      Releases this Entry to the Pool.

      Returns:
      whether this Entry was released
    • remove

      boolean remove()

      Removes this Entry from the Pool.

      Returns:
      whether this Entry was removed
    • isReserved

      boolean isReserved()
      Returns:
      whether this Entry is reserved
      See Also:
    • isIdle

      boolean isIdle()
      Returns:
      whether this Entry is idle in the Pool
    • isInUse

      boolean isInUse()
      Returns:
      whether this Entry is in use
    • isTerminated

      boolean isTerminated()
      Returns:
      whether this Entry is terminated