|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quartzdesk.api.agent.log.WorkerThreadLoggingInterceptorRegistry
public class WorkerThreadLoggingInterceptorRegistry
A registry that can be used to turn on/off interception of log messages produced by worker threads spawned and used by executing jobs. The registry is to be used like so:
public class MyCallable
implements Callable
{
private Thread jobThread;
// @param jobThread the main job execution thread that will be using this Callable instance.
public MyCallable( Thread jobThread )
{
this.jobThread = jobThread;
}
public Foo call()
throws Exception
{
// Start intercepting logging events from the current worker thread (returned by Thread.currentThread())
// and associate these events with the specified main job execution thread.
WorkerThreadLoggingInterceptorRegistry.INSTANCE.startIntercepting( jobThread );
try
{
// some business logic and logging
return foo;
}
finally
{
// Stop intercepting logging events from the current worker thread.
WorkerThreadLoggingInterceptorRegistry.INSTANCE.stopIntercepting();
}
}
}
| Field Summary | |
|---|---|
static WorkerThreadLoggingInterceptorRegistry |
INSTANCE
|
| Method Summary | |
|---|---|
Thread |
getJobThreadForWorkerThread(Thread workerThread)
Returns the job thread associated with the specified thread. |
void |
startIntercepting(Thread jobThread)
Starts intercepting log messages produced by the current thread (as returned by Thread.currentThread())
that is used by the specified job thread. |
void |
stopIntercepting()
Stops intercepting log messages produced by the current thread (as returned by Thread.currentThread()). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final WorkerThreadLoggingInterceptorRegistry INSTANCE
| Method Detail |
|---|
public Thread getJobThreadForWorkerThread(Thread workerThread)
workerThread - a worker thread.
public void startIntercepting(Thread jobThread)
Thread.currentThread())
that is used by the specified job thread.
jobThread - a job thread.public void stopIntercepting()
Thread.currentThread()).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||