Class PersistentThreadLocal<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Thread,​T> allValues  
      protected java.util.function.Supplier<? extends T> valueGetter  
    • Constructor Summary

      Constructors 
      Constructor Description
      PersistentThreadLocal​(int numThreads, java.util.function.Supplier<? extends T> initialValue)  
      PersistentThreadLocal​(java.util.function.Supplier<? extends T> initialValue)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<T> getAll()  
      protected T initialValue()  
      void remove()  
      void removeAll()  
      void set​(T value)  
      int size()  
      • Methods inherited from class java.lang.ThreadLocal

        get, withInitial
      • Methods inherited from class java.lang.Object

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

      • allValues

        protected final java.util.Map<java.lang.Thread,​T> allValues
      • valueGetter

        protected final java.util.function.Supplier<? extends T> valueGetter
    • Constructor Detail

      • PersistentThreadLocal

        public PersistentThreadLocal​(java.util.function.Supplier<? extends T> initialValue)
      • PersistentThreadLocal

        public PersistentThreadLocal​(int numThreads,
                                     java.util.function.Supplier<? extends T> initialValue)
    • Method Detail

      • initialValue

        protected T initialValue()
        Overrides:
        initialValue in class java.lang.ThreadLocal<T>
      • set

        public void set​(T value)
        Overrides:
        set in class java.lang.ThreadLocal<T>
      • remove

        public void remove()
        Overrides:
        remove in class java.lang.ThreadLocal<T>
      • getAll

        public java.util.Collection<T> getAll()
      • size

        public int size()
      • removeAll

        public void removeAll()