Class RecycleOnClose<T,​E extends java.lang.Exception>

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class RecycleOnClose<T,​E extends java.lang.Exception>
    extends java.lang.Object
    implements java.lang.AutoCloseable
    An AutoCloseable wrapper for a recyclable object instance. Obtained by calling Recycler.acquireRecycleOnClose() in a try-with-resources statement, so that when the try block exits, the acquired instance is recycled.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Recycle an instance.
      T get()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        public T get()
        Returns:
        The new or recycled object instance.
      • close

        public void close()
        Recycle an instance. Calls Resettable.reset() if the instance implements Resettable.
        Specified by:
        close in interface java.lang.AutoCloseable