org.oddjob.jmx.client
Class RemoteLogPoller

java.lang.Object
  extended by org.oddjob.jmx.client.RemoteLogPoller
All Implemented Interfaces:
Runnable, ConsoleArchiver, LogArchiver

public class RemoteLogPoller
extends Object
implements Runnable, LogArchiver, ConsoleArchiver

A LogArchiver which maintains it's log archives by polling a JMX MBean for log information.

Author:
Rob Gordon

Field Summary
 
Fields inherited from interface org.oddjob.logging.LogArchiver
MAX_HISTORY, NO_LOG_AVAILABLE
 
Constructor Summary
RemoteLogPoller(Object root, int consoleHistoryLines, int logHistoryLines)
          Constructor.
 
Method Summary
 void addConsoleListener(LogListener l, Object component, long last, int max)
          Add a listener to the archiver which will receive all missed events.
 void addLogListener(LogListener l, Object component, LogLevel level, long last, int max)
          Add a listener to the archiver which will receive all missed events.
 String consoleIdFor(Object component)
          Get the console id for a given component.
 long getLogPollingInterval()
           
 void onDestroy()
           
 void poll()
          Poll a remote MBean for Log Messages.
 void removeConsoleListener(LogListener l, Object component)
          Remove the LogListener.
 void removeLogListener(LogListener l, Object component)
          Remove the LogListener.
 void run()
           
 void setLogPollingInterval(long logPollingInterval)
           
 void stop()
          Stop polling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteLogPoller

public RemoteLogPoller(Object root,
                       int consoleHistoryLines,
                       int logHistoryLines)
Constructor.

Method Detail

addLogListener

public void addLogListener(LogListener l,
                           Object component,
                           LogLevel level,
                           long last,
                           int max)
Description copied from interface: LogArchiver
Add a listener to the archiver which will receive all missed events. The idea of receiving only missed events is to minimise network traffic when used remotely.

Event numbers begin at 0. To recieve all events, last must be -1.

Specified by:
addLogListener in interface LogArchiver
Parameters:
l - The logListener which will recieve the events.
level - The level of events required.
last - The last event number recieved. The LogArchive will not send messages from before this number.
max - The maximum messages to send up to the most recent.

removeLogListener

public void removeLogListener(LogListener l,
                              Object component)
Description copied from interface: LogArchiver
Remove the LogListener.

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

addConsoleListener

public void addConsoleListener(LogListener l,
                               Object component,
                               long last,
                               int max)
Description copied from interface: ConsoleArchiver
Add a listener to the archiver which will receive all missed events. The idea of receiving only missed event is to minimise network traffic when used remotely.

Specified by:
addConsoleListener in interface ConsoleArchiver
Parameters:
l - The logListener which will recieve the events.
component - The component whose console to receive events for.
last - The last event number recieved. The LogArchive will not send messages from before this number.
max - The maximum messages to send up to the most recent.

removeConsoleListener

public void removeConsoleListener(LogListener l,
                                  Object component)
Description copied from interface: ConsoleArchiver
Remove the LogListener.

Specified by:
removeConsoleListener in interface ConsoleArchiver
Parameters:
l - The LogListener.

consoleIdFor

public String consoleIdFor(Object component)
Description copied from interface: ConsoleArchiver
Get the console id for a given component.

Specified by:
consoleIdFor in interface ConsoleArchiver
Parameters:
component - The component.
Returns:
The console id.

getLogPollingInterval

public long getLogPollingInterval()

setLogPollingInterval

public void setLogPollingInterval(long logPollingInterval)

poll

public void poll()
Poll a remote MBean for Log Messages.


run

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

stop

public void stop()
Stop polling.


onDestroy

public void onDestroy()