Class Recycler<T extends AutoCloseable,E extends Exception>
- java.lang.Object
-
- io.github.lukehutch.fastclasspathscanner.utils.Recycler<T,E>
-
- All Implemented Interfaces:
AutoCloseable
public abstract class Recycler<T extends AutoCloseable,E extends Exception> extends Object implements AutoCloseable
Recycle instances of type T. The method T#close() is called when this class' own close() method is called. Use RuntimeException for type E if the newInstance() method does not throw an exception.
-
-
Constructor Summary
Constructors Constructor Description Recycler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tacquire()Acquire or allocate an instance.voidclose()Call this only after all instances have been released.abstract TnewInstance()Create a new instance.voidrelease(T instance)Release/recycle an instance.
-