FileDocCategorySizeDatePackage
AbstractMonitor.javaAPI DocGlassfish v2 API4161Fri May 04 22:35:40 BST 2007com.sun.enterprise.server

AbstractMonitor

public abstract class AbstractMonitor extends TimerTask
Base class for all monitors. It provides functionality to perform repeated tasks from server runtime.
atuthor
Nazrul Islam
since
JDK 1.4

Fields Summary
protected HashSet
_monitoredEntries
contains all the monitored entries
protected Timer
_timer
timer to run this task
protected long
_pollInterval
polling interval for the timer
Constructors Summary
AbstractMonitor(long pollInterval)
Constructor.

param
pollInterval polling interval

        this._pollInterval      = pollInterval;
        this._monitoredEntries  = new HashSet();
    
Methods Summary
voidaddMonitorableEntry(MonitorableEntry entry)
Adds the given monitorable entry to the list.

param
entry a monitorable entry


        synchronized (this._monitoredEntries) {
            this._monitoredEntries.add(entry);
        }
    
voidremoveMonitorableEntry(MonitorableEntry entry)
Removes the monitorable entry from the list.

param
entry monitorable entry to be removed


        synchronized (this._monitoredEntries) {
            this._monitoredEntries.remove(entry);
        }
    
voidstart()
Starts this monitor.

        this._timer = new Timer(true);
        this._timer.schedule(this, 0, this._pollInterval);
    
voidstop()
Stops this monitor.

        if (this._timer != null) {
            this._timer.cancel();
        }