public class InstrumentedThreadFactory extends Object implements ThreadFactory
ThreadFactory
that monitors the number of threads created, running and terminated.
It will register the metrics using the given (or auto-generated) name as classifier, e.g:
"your-thread-delegate.created", "your-thread-delegate.running", etc.Constructor and Description |
---|
InstrumentedThreadFactory(ThreadFactory delegate,
MetricRegistry registry)
Wraps a
ThreadFactory , uses a default auto-generated name. |
InstrumentedThreadFactory(ThreadFactory delegate,
MetricRegistry registry,
String name)
Wraps a
ThreadFactory with an explicit name. |
public InstrumentedThreadFactory(ThreadFactory delegate, MetricRegistry registry)
ThreadFactory
, uses a default auto-generated name.delegate
- ThreadFactory
to wrap.registry
- MetricRegistry
that will contain the metrics.public InstrumentedThreadFactory(ThreadFactory delegate, MetricRegistry registry, String name)
ThreadFactory
with an explicit name.delegate
- ThreadFactory
to wrap.registry
- MetricRegistry
that will contain the metrics.name
- name for this delegate.public Thread newThread(Runnable runnable)
newThread
in interface ThreadFactory
Copyright © 2014. All Rights Reserved.