Package org.h2.util

Class DebuggingThreadLocal<T>

  • Type Parameters:
    T - the type

    public class DebuggingThreadLocal<T>
    extends java.lang.Object
    Similar to ThreadLocal, except that it allows its data to be read from other threads - useful for debugging info.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.concurrent.ConcurrentHashMap<java.lang.Long,​T> map  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()  
      java.util.HashMap<java.lang.Long,​T> getSnapshotOfAllThreads()
      Get a snapshot of the data of all threads.
      void remove()
      Remove the value for the current thread.
      void set​(T value)  
      • Methods inherited from class java.lang.Object

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

      • map

        private final java.util.concurrent.ConcurrentHashMap<java.lang.Long,​T> map
    • Constructor Detail

      • DebuggingThreadLocal

        public DebuggingThreadLocal()
    • Method Detail

      • set

        public void set​(T value)
      • remove

        public void remove()
        Remove the value for the current thread.
      • get

        public T get()
      • getSnapshotOfAllThreads

        public java.util.HashMap<java.lang.Long,​T> getSnapshotOfAllThreads()
        Get a snapshot of the data of all threads.
        Returns:
        a HashMap containing a mapping from thread-id to value