Package com.codahale.metrics
Class InstrumentedThreadFactory
- java.lang.Object
-
- com.codahale.metrics.InstrumentedThreadFactory
-
- All Implemented Interfaces:
ThreadFactory
public class InstrumentedThreadFactory extends Object implements ThreadFactory
AThreadFactory
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 Summary
Constructors Constructor Description InstrumentedThreadFactory(ThreadFactory delegate, MetricRegistry registry)
Wraps aThreadFactory
, uses a default auto-generated name.InstrumentedThreadFactory(ThreadFactory delegate, MetricRegistry registry, String name)
Wraps aThreadFactory
with an explicit name.
-
-
-
Constructor Detail
-
InstrumentedThreadFactory
public InstrumentedThreadFactory(ThreadFactory delegate, MetricRegistry registry)
Wraps aThreadFactory
, uses a default auto-generated name.- Parameters:
delegate
-ThreadFactory
to wrap.registry
-MetricRegistry
that will contain the metrics.
-
InstrumentedThreadFactory
public InstrumentedThreadFactory(ThreadFactory delegate, MetricRegistry registry, String name)
Wraps aThreadFactory
with an explicit name.- Parameters:
delegate
-ThreadFactory
to wrap.registry
-MetricRegistry
that will contain the metrics.name
- name for this delegate.
-
-
Method Detail
-
newThread
public Thread newThread(Runnable runnable)
- Specified by:
newThread
in interfaceThreadFactory
-
-