public class LoggerThreadListener extends Object implements ThreadMonitor.ThreadListener
| Constructor and Description |
|---|
LoggerThreadListener(String threadIdPrefix,
org.slf4j.Logger logger,
javax.measure.Measurable<javax.measure.quantity.Duration> executionDurationThreshold)
Creates a new
ThreadMonitor.ThreadListener. |
| Modifier and Type | Method and Description |
|---|---|
void |
executing(Collection<ThreadMonitor.ThreadExecutionState> states)
Callback method to notify a snapshot of the active threads in
execution.
|
void |
failed(ThreadMonitor.ThreadExecutionState state,
Exception failure)
Callback method to notify a thread has failed and the exception was
not caught.
|
void |
finished(ThreadMonitor.ThreadExecutionState state)
Callback method to notify a thread has finished execution.
|
void |
overlapped(ThreadMonitor.ThreadExecutionState state,
javax.measure.Measurable<javax.measure.quantity.Duration> period)
Callback method to notify when a
Runnable is submitted to
be executed at a fixed rate but it took more time to execute than
its period. |
void |
started(ThreadMonitor.ThreadExecutionState state)
Callback method to notify a thread has started execution.
|
public LoggerThreadListener(String threadIdPrefix, org.slf4j.Logger logger, javax.measure.Measurable<javax.measure.quantity.Duration> executionDurationThreshold)
ThreadMonitor.ThreadListener.threadIdPrefix - a prefix for the thread Id used as a convenient
way of identifying logs associated to thread monitoring. For
example, using "th-" as threadIdPrefix would produce
logs messages starting with "th-1" for the first executed
thread.logger - logger used to write threads stateexecutionDurationThreshold - when a thread takes more time in
execution state than executionDurationThreshold a
warning log will be created.public void started(ThreadMonitor.ThreadExecutionState state)
ThreadMonitor.ThreadListenerNote: ThreadExecutionState's end time is updated by the executing thread, so by the moment the state is processed the thread might have finished execution.
started in interface ThreadMonitor.ThreadListenerstate - thread execution statepublic void finished(ThreadMonitor.ThreadExecutionState state)
ThreadMonitor.ThreadListenerfinished in interface ThreadMonitor.ThreadListenerstate - thread execution statepublic void executing(Collection<ThreadMonitor.ThreadExecutionState> states)
ThreadMonitor.ThreadListenerNote: ThreadExecutionState's end time is updated by the executing thread, so by the moment the state is processed the thread might have finished execution.
executing in interface ThreadMonitor.ThreadListenerstates - threads execution statespublic void overlapped(ThreadMonitor.ThreadExecutionState state, javax.measure.Measurable<javax.measure.quantity.Duration> period)
ThreadMonitor.ThreadListenerRunnable is submitted to
be executed at a fixed rate but it took more time to execute than
its period.overlapped in interface ThreadMonitor.ThreadListenerstate - thread execution stateperiod - period the Runnable was scheduled with.public void failed(ThreadMonitor.ThreadExecutionState state, Exception failure)
ThreadMonitor.ThreadListenerfailed in interface ThreadMonitor.ThreadListenerstate - thread execution statefailure - failureCopyright © 2014. All Rights Reserved.