Class ThreadLocalRecycler<V>

  • All Implemented Interfaces:
    Recycler<V>

    public class ThreadLocalRecycler<V>
    extends java.lang.Object
    implements Recycler<V>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.function.Consumer<V> cleaner  
      private java.lang.ThreadLocal<V> holder  
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadLocalRecycler​(java.util.function.Supplier<V> supplier, java.util.function.Consumer<V> cleaner)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V acquire()  
      void release​(V value)  
      • Methods inherited from class java.lang.Object

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

      • cleaner

        private final java.util.function.Consumer<V> cleaner
      • holder

        private final java.lang.ThreadLocal<V> holder
    • Constructor Detail

      • ThreadLocalRecycler

        public ThreadLocalRecycler​(java.util.function.Supplier<V> supplier,
                                   java.util.function.Consumer<V> cleaner)