com.resilientedge.util.logger
Class LoggerWorker

java.lang.Object
  |
  +--com.resilientedge.util.logger.LoggerWorker
All Implemented Interfaces:
Work

public class LoggerWorker
extends java.lang.Object
implements Work

A LoggerWorker object represents a unit of logging work that is to be performed asynchronously. Essentially, a unit of logging work means "the processing by each of a Logger's handlers of a single logRecord."

A LoggerWorker can be used as follows: A Logger should establish a WorkerPool where the LogWorker is identified in the WorkPool's init(). Once the WorkerPool is properly created, the logger can call the pools doWork() method, passing doWork() the logRecord to be asynchronously processed.

Author:
odh
See Also:
Work, WorkerPool

Constructor Summary
LoggerWorker()
          Default constructor.
 
Method Summary
 void dispose()
          This is called when the object is being removed from the worker pool.
 java.lang.Object doWork(java.lang.Object obj)
          This is invoked through the worker pool to perform a unit of work on a secondary thread.
protected  void forwardToHandlers(LogRecord logRecord)
          This method forwards a LogRecord to each of the Logger's Handlers for processing and exporting.
 void init()
          Initialization is invoked after the object is instantiated, and before it is added to a worker pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerWorker

public LoggerWorker()
Default constructor.
Method Detail

init

public void init()
Initialization is invoked after the object is instantiated, and before it is added to a worker pool.
Specified by:
init in interface Work

dispose

public void dispose()
This is called when the object is being removed from the worker pool. It is a chance to cleanup any resources.
Specified by:
dispose in interface Work

doWork

public java.lang.Object doWork(java.lang.Object obj)
This is invoked through the worker pool to perform a unit of work on a secondary thread. When this method is called, its unit of work is forwarding the logRecord to the handlers.
Specified by:
doWork in interface Work
Parameters:
obj - the LogRecord that is to be processed by the handlers.
Returns:
since a listener is not being used, we just return null.

forwardToHandlers

protected void forwardToHandlers(LogRecord logRecord)
This method forwards a LogRecord to each of the Logger's Handlers for processing and exporting.
Parameters:
logRecord -  


Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.