Package org.jpos.util

Class Recyclable<T>

  • Type Parameters:
    T - the type of results supplied by this supplier
    All Implemented Interfaces:
    java.util.function.Supplier<T>

    public class Recyclable<T>
    extends java.lang.Object
    implements java.util.function.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

      Constructors 
      Constructor Description
      Recyclable​(java.util.function.Supplier<T> supplier, long maxCycles)  
    • Method Summary

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

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

      • Recyclable

        public Recyclable​(java.util.function.Supplier<T> supplier,
                          long maxCycles)
    • Method Detail

      • get

        public T get()
        Specified by:
        get in interface java.util.function.Supplier<T>