org.apache.avalon.excalibur.monitor.impl
Class ActiveMonitor

java.lang.Object
  extended by org.apache.avalon.excalibur.monitor.impl.AbstractMonitor
      extended by org.apache.avalon.excalibur.monitor.impl.ActiveMonitor
All Implemented Interfaces:
java.lang.Runnable, Monitor, org.apache.avalon.framework.component.Component
Direct Known Subclasses:
ActiveMonitor

public class ActiveMonitor
extends AbstractMonitor
implements java.lang.Runnable

The ActiveMonitor is used to actively check a set of resources to see if they have changed. It will poll the resources with a frequency as specified or if unspecified with the default (60 seconds).

Version:
$Id: ActiveMonitor.java,v 1.5 2004/02/28 11:47:35 cziegeler Exp $
Author:
Avalon Development Team

Field Summary
private static long DEFAULT_FREQUENCY
           
private  long m_frequency
          The frequency to scan resources for changes measured in milliseconds.
private  boolean m_keepRunning
          Set to false to shutdown the thread.
private  java.lang.Thread m_monitorThread
          The thread that does the monitoring.
private  int m_priority
          The priority of the thread that monitors resources.
 
Fields inherited from interface org.apache.avalon.excalibur.monitor.Monitor
ROLE
 
Constructor Summary
ActiveMonitor()
           
 
Method Summary
 void run()
           
 void setFrequency(long frequency)
          Set the frequency with which the monitor checks the resources.
 void setPriority(int priority)
          Set the priority of the active monitors thread.
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.avalon.excalibur.monitor.impl.AbstractMonitor
addResource, addResources, getResource, getResources, removeResource, removeResource, scanAllResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FREQUENCY

private static final long DEFAULT_FREQUENCY
See Also:
Constant Field Values

m_frequency

private long m_frequency
The frequency to scan resources for changes measured in milliseconds.


m_priority

private int m_priority
The priority of the thread that monitors resources. Defaults to System specific Thread.MIN_PRIORITY.


m_monitorThread

private final java.lang.Thread m_monitorThread
The thread that does the monitoring.


m_keepRunning

private volatile boolean m_keepRunning
Set to false to shutdown the thread.

Constructor Detail

ActiveMonitor

public ActiveMonitor()
Method Detail

setFrequency

public void setFrequency(long frequency)
Set the frequency with which the monitor checks the resources. This can be changed anytime and will be enabled the next time through the check.

Parameters:
frequency - the frequency to scan resources for changes

setPriority

public void setPriority(int priority)
Set the priority of the active monitors thread.

Parameters:
priority - the priority of the active monitors thread.

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Throws:
java.lang.Exception

run

public final void run()
Specified by:
run in interface java.lang.Runnable