org.oddjob.logging.cache
Class PollingLogArchiver

java.lang.Object
  extended by org.oddjob.logging.cache.PollingLogArchiver
All Implemented Interfaces:
LogArchiver

public class PollingLogArchiver
extends Object
implements LogArchiver

A LogArchiver which maintains it's log archives by polling.

This archiver will remove a component from it's list of components to poll when no more listeners are listening to it.

This archiver will only poll the first component where many components share the same archive.

Author:
Rob Gordon

Field Summary
 
Fields inherited from interface org.oddjob.logging.LogArchiver
MAX_HISTORY, NO_LOG_AVAILABLE
 
Constructor Summary
PollingLogArchiver(ArchiveNameResolver resolver, LogEventSource source)
          Constructor with default history.
PollingLogArchiver(int history, ArchiveNameResolver resolver, LogEventSource source)
          Constructor that accepts a history count.
 
Method Summary
 void addLogListener(LogListener l, Object component, LogLevel level, long last, int max)
          Add a LogListener for the given component.
 void onDestroy()
           
 void poll()
          Poll for Log Messages.
 void removeLogListener(LogListener l, Object component)
          Remove the LogListener for the given component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollingLogArchiver

public PollingLogArchiver(ArchiveNameResolver resolver,
                          LogEventSource source)
Constructor with default history.


PollingLogArchiver

public PollingLogArchiver(int history,
                          ArchiveNameResolver resolver,
                          LogEventSource source)
Constructor that accepts a history count.

Method Detail

addLogListener

public void addLogListener(LogListener l,
                           Object component,
                           LogLevel level,
                           long last,
                           int max)
Add a LogListener for the given component.

Specified by:
addLogListener in interface LogArchiver
Parameters:
l - The LogListener.
component - The component.
level - The level.
last - The last message number required.
max - The maximum history.

removeLogListener

public void removeLogListener(LogListener l,
                              Object component)
Remove the LogListener for the given component.

Specified by:
removeLogListener in interface LogArchiver
Parameters:
l - The LogListener.
component - The component.

poll

public void poll()
Poll for Log Messages.


onDestroy

public void onDestroy()