org.apache.commons.monitoring.impl.monitors
Class ObservableMonitor

java.lang.Object
  extended by org.apache.commons.monitoring.impl.monitors.AbstractMonitor
      extended by org.apache.commons.monitoring.impl.monitors.ObservableMonitor
All Implemented Interfaces:
Monitor, Monitor.Observable
Direct Known Subclasses:
CreateValuesOnDemandMonitor

public abstract class ObservableMonitor
extends AbstractMonitor
implements Monitor.Observable

Monitor implementation with support for listeners

Author:
Nicolas De Loof

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.commons.monitoring.Monitor
Monitor.Key, Monitor.Listener, Monitor.Observable
 
Field Summary
 
Fields inherited from interface org.apache.commons.monitoring.Monitor
CONCURRENCY, FAILURES, PERFORMANCES
 
Constructor Summary
ObservableMonitor(Monitor.Key key)
          Constructor
 
Method Summary
 void addListener(Monitor.Listener listener)
           
protected
<T extends StatValue>
T
register(T value)
          Register the StatValue for the role, if none was registered before
 void removeListener(Monitor.Listener listener)
           
 
Methods inherited from class org.apache.commons.monitoring.impl.monitors.AbstractMonitor
getCounter, getCounter, getGauge, getGauge, getKey, getRoles, getValue, getValue, getValues, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.monitoring.Monitor
getCounter, getCounter, getGauge, getGauge, getKey, getRoles, getValue, getValue, getValues, reset
 

Constructor Detail

ObservableMonitor

public ObservableMonitor(Monitor.Key key)
Constructor

Parameters:
key - the monitor identifier
Method Detail

register

protected <T extends StatValue> T register(T value)
Register the StatValue for the role, if none was registered before

Overrides:
register in class AbstractMonitor
Parameters:
value -
role -
Returns:
the value registered, or a previously existing one

addListener

public void addListener(Monitor.Listener listener)
Specified by:
addListener in interface Monitor.Observable
Parameters:
listener - listener to get registered

removeListener

public void removeListener(Monitor.Listener listener)
Specified by:
removeListener in interface Monitor.Observable
Parameters:
listener - listener to get removed


Copyright © 2008 The Apache Software Foundation. All Rights Reserved.