Module stormpot
Package stormpot

Class Pooled<T>

Type Parameters:
T - The type of object referenced by the Pooled.
All Implemented Interfaces:
AutoCloseable, Poolable

public class Pooled<T> extends BasePoolable implements Poolable, AutoCloseable
A reference to a pooled object.
  • Field Details

    • object

      @Deprecated public final T object
      Deprecated.
      Use getObject() instead.
      The object managed by this pooled instance.
  • Constructor Details

    • Pooled

      public Pooled(Slot slot, T object)
      Create a pooled object for the given slot and object to be pooled.
      Parameters:
      slot - The slot an object is being allocated for.
      object - The object this pooled instance represents.
  • Method Details

    • getObject

      public T getObject()
      Get the pooled object.
      Returns:
      The pooled object held by this Pooled reference.
    • close

      public void close()
      Pooled implements AutoCloseable as a convenient way to release claimed objects back to the pool, using the try-with-resources syntax.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object