Class ThreadMonitor.AutoRegisteringThreadFactory

  • All Implemented Interfaces:
    ThreadFactory
    Enclosing class:
    ThreadMonitor

    public static class ThreadMonitor.AutoRegisteringThreadFactory
    extends Object
    implements ThreadFactory
    Thread factory that registers all new threads with a given thread monitor. This can be passed to an Executor, so that all of its threads will be monitored, which may be simpler than manually registering each individual thread.
    • Constructor Detail

      • AutoRegisteringThreadFactory

        public AutoRegisteringThreadFactory​(ThreadMonitor threadMonitor,
                                            ThreadFactory delegate)
        Parameters:
        threadMonitor - The thread monitor where to register new threads.
        delegate - A thread factory to create new threads.
      • AutoRegisteringThreadFactory

        public AutoRegisteringThreadFactory​(ThreadMonitor threadMonitor)
        Uses Executors.defaultThreadFactory() to create new threads.
        Parameters:
        threadMonitor - The thread monitor where to register new threads.