Class Recyclable<T>
java.lang.Object
org.jpos.util.Recyclable<T>
- Type Parameters:
T- the type of results supplied by this supplier
- All Implemented Interfaces:
Supplier<T>
Caches a supplier's result up to approximately
maxCycles.
After approximately maxCycles calls to its get() operation,
Recyclable fetches a new result from its underlying Supplier.
- Since:
- 2.1.3
-
Constructor Summary
ConstructorsConstructorDescriptionRecyclable(Supplier<T> supplier, long maxCycles) Constructs a Recyclable that delegates tosupplierand rebuilds the wrapped object everymaxCyclesuses. -
Method Summary
-
Constructor Details
-
Recyclable
Constructs a Recyclable that delegates tosupplierand rebuilds the wrapped object everymaxCyclesuses.- Parameters:
supplier- factory that produces fresh instancesmaxCycles- number of uses before the wrapped instance is replaced
-
-
Method Details
-
get
-