org.apache.commons.monitoring.listeners
Class SecondaryMonitor

java.lang.Object
  extended by org.apache.commons.monitoring.impl.monitors.AbstractMonitor
      extended by org.apache.commons.monitoring.listeners.SecondaryMonitor
All Implemented Interfaces:
Detachable, Monitor, Monitor.Listener

public class SecondaryMonitor
extends AbstractMonitor
implements Monitor.Listener, Detachable

A Monitor implementation that maintains a set of secondary StatValues in sync with the primary monitor. Register itself as a monitor listener to get notified on new StatValues and automatically create the required secondary.

When detached, deregister itself as Monitor.Listener and detaches all secondary from the primary StatValues.

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
SecondaryMonitor(Monitor.Observable monitor)
           
 
Method Summary
 void detach()
          Detach the instance from live monitoring beackbone.
 long getAttachedAt()
           
 long getDetachedAt()
           
 boolean isDetached()
           
 void onStatValueRegistered(StatValue value)
           
 
Methods inherited from class org.apache.commons.monitoring.impl.monitors.AbstractMonitor
getCounter, getCounter, getGauge, getGauge, getKey, getRoles, getValue, getValue, getValues, register, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondaryMonitor

public SecondaryMonitor(Monitor.Observable monitor)
Method Detail

detach

public void detach()
Description copied from interface: Detachable
Detach the instance from live monitoring beackbone. Any new monitoring event will not affect datas in this component.

Specified by:
detach in interface Detachable

onStatValueRegistered

public void onStatValueRegistered(StatValue value)
Specified by:
onStatValueRegistered in interface Monitor.Listener

isDetached

public boolean isDetached()
Specified by:
isDetached in interface Detachable

getAttachedAt

public long getAttachedAt()
Specified by:
getAttachedAt in interface Detachable

getDetachedAt

public long getDetachedAt()
Specified by:
getDetachedAt in interface Detachable


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