Class Suppliers
- java.lang.Object
-
- org.apache.activemq.artemis.utils.Suppliers
-
public class Suppliers extends Object
-
-
Constructor Summary
Constructors Constructor Description Suppliers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Supplier<T>
memoize(Supplier<T> delegate)
Returns a supplier which caches the instance retrieved during the first call toget()
and returns that value on subsequent calls toget()
.
-
-
-
Method Detail
-
memoize
public static <T> Supplier<T> memoize(Supplier<T> delegate)
Returns a supplier which caches the instance retrieved during the first call toget()
and returns that value on subsequent calls toget()
. See: memoizationThe returned supplier is thread-safe. The delegate's
get()
method will be invoked at most once. The supplier's serialized form does not contain the cached value, which will be recalculated whenget()
is called on the reserialized instance.If
delegate
is an instance created by an earlier call tomemoize
, it is returned directly.
-
-