Class RecycleOnClose<T,E extends java.lang.Exception>
- java.lang.Object
-
- nonapi.io.github.classgraph.recycler.RecycleOnClose<T,E>
-
- 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 callingRecycler.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()
-
-
-
Method Detail
-
get
public T get()
- Returns:
- The new or recycled object instance.
-
close
public void close()
Recycle an instance. CallsResettable.reset()
if the instance implementsResettable
.- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-