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

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

public class CreateValuesOnDemandMonitor
extends ObservableMonitor

implementation of the Monitor interface that creates StatValues on demand. The application can request for Counters/Gauges without having to handle instantiation of monitors with all required StatValues pre-registered.

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
CreateValuesOnDemandMonitor(Monitor.Key key)
           
 
Method Summary
 Counter getCounter(Role<Counter> role)
          Retrieve a Counter or create a new one for the role
 Gauge getGauge(Role<Gauge> role)
          Retrieve a Gauge or create a new one for the role
protected  Counter newCounterInstance(Role<Counter> role)
          Create a new Counter instance
protected  Gauge newGaugeInstance(Role<Gauge> role)
          Create a new Gauge instance
 
Methods inherited from class org.apache.commons.monitoring.impl.monitors.ObservableMonitor
addListener, register, removeListener
 
Methods inherited from class org.apache.commons.monitoring.impl.monitors.AbstractMonitor
getCounter, 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, getGauge, getKey, getRoles, getValue, getValue, getValues, reset
 

Constructor Detail

CreateValuesOnDemandMonitor

public CreateValuesOnDemandMonitor(Monitor.Key key)
Method Detail

getCounter

public Counter getCounter(Role<Counter> role)
Retrieve a Counter or create a new one for the role

Specified by:
getCounter in interface Monitor
Overrides:
getCounter in class AbstractMonitor
Parameters:
role - the Counter role in the monitor
Returns:
the Counter

newCounterInstance

protected Counter newCounterInstance(Role<Counter> role)
Create a new Counter instance


getGauge

public Gauge getGauge(Role<Gauge> role)
Retrieve a Gauge or create a new one for the role

Specified by:
getGauge in interface Monitor
Overrides:
getGauge in class AbstractMonitor
Parameters:
role - the gauge role in the monitor
Returns:
the Gauge

newGaugeInstance

protected Gauge newGaugeInstance(Role<Gauge> role)
Create a new Gauge instance



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