Openfire 3.3.2 Javadoc

org.jivesoftware.util.log.output
Class AsyncLogTarget

java.lang.Object
  extended by org.jivesoftware.util.log.output.AbstractTarget
      extended by org.jivesoftware.util.log.output.AsyncLogTarget
All Implemented Interfaces:
Runnable, ErrorAware, LogTarget

public class AsyncLogTarget
extends AbstractTarget
implements Runnable

An asynchronous LogTarget that sends entries on in another thread. It is the responsibility of the user of this class to start the thread etc.

 LogTarget mySlowTarget = ...;
 AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
 Thread thread = new Thread( asyncTarget );
 thread.setPriority( Thread.MIN_PRIORITY );
 thread.start();
 

logger.setLogTargets( new LogTarget[] { asyncTarget } );

Author:
Peter Donald

Constructor Summary
AsyncLogTarget(LogTarget logTarget)
           
AsyncLogTarget(LogTarget logTarget, int queueSize)
           
 
Method Summary
 void doProcessEvent(LogEvent event)
          Process a log event by adding it to queue.
 void run()
           
 void setErrorHandler(ErrorHandler errorHandler)
          Provide component with ErrorHandler.
 
Methods inherited from class org.jivesoftware.util.log.output.AbstractTarget
close, error, getErrorHandler, isOpen, open, processEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncLogTarget

public AsyncLogTarget(LogTarget logTarget)

AsyncLogTarget

public AsyncLogTarget(LogTarget logTarget,
                      int queueSize)
Method Detail

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Provide component with ErrorHandler.

Specified by:
setErrorHandler in interface ErrorAware
Overrides:
setErrorHandler in class AbstractTarget
Parameters:
errorHandler - the errorHandler

doProcessEvent

public void doProcessEvent(LogEvent event)
Process a log event by adding it to queue.

Specified by:
doProcessEvent in class AbstractTarget
Parameters:
event - the log event

run

public void run()
Specified by:
run in interface Runnable

Openfire 3.3.2 Javadoc

Copyright © 2003-2007 Jive Software.