Class ThreadRegistry


  • public class ThreadRegistry
    extends java.lang.Object
    For mapping thread ids to thread pools and threads within those pools or just for lone named threads. Thread scoped metrics add labels to metrics by retrieving the ThreadPoolThread object from this registry. For flexibility, this registry is not based on TLS.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadRegistry()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clear()  
      static void forceClearRegistrationForTests​(long threadId)
      In some tests we run in the same thread activities that should run in different threads from different thread-pools this would trigger assertions to fail.
      static ThreadRegistry.ThreadPoolThread get()  
      static void register​(java.lang.String threadPool)  
      static void register​(java.lang.String threadPool, boolean force)  
      static void register​(java.lang.String threadPool, int threadPoolThread)  
      static void register​(java.lang.String threadPool, int threadPoolThread, long threadId)  
      static java.lang.Runnable registerThread​(java.lang.Runnable runnable, java.lang.String threadPool)  
      • Methods inherited from class java.lang.Object

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

      • ThreadRegistry

        public ThreadRegistry()
    • Method Detail

      • register

        public static void register​(java.lang.String threadPool)
      • register

        public static void register​(java.lang.String threadPool,
                                    boolean force)
      • forceClearRegistrationForTests

        public static void forceClearRegistrationForTests​(long threadId)
        In some tests we run in the same thread activities that should run in different threads from different thread-pools this would trigger assertions to fail. This is a convenience method to work around such cases. This method shouldn't be used in production code.
      • register

        public static void register​(java.lang.String threadPool,
                                    int threadPoolThread)
      • register

        public static void register​(java.lang.String threadPool,
                                    int threadPoolThread,
                                    long threadId)
      • registerThread

        public static java.lang.Runnable registerThread​(java.lang.Runnable runnable,
                                                        java.lang.String threadPool)
      • clear

        public static void clear()