Class ThreadRegistry

java.lang.Object
org.apache.bookkeeper.stats.ThreadRegistry

public class ThreadRegistry extends 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 Details

    • ThreadRegistry

      public ThreadRegistry()
  • Method Details

    • register

      public static void register(String threadPool)
    • register

      public static void register(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(String threadPool, int threadPoolThread)
    • register

      public static void register(String threadPool, int threadPoolThread, long threadId)
    • registerThread

      public static Runnable registerThread(Runnable runnable, String threadPool)
    • clear

      public static void clear()
    • get

      public static ThreadRegistry.ThreadPoolThread get()