org.jmonit.monitors
Class NullMonitor

java.lang.Object
  extended by org.jmonit.monitors.NullMonitor
All Implemented Interfaces:
Monitor

public class NullMonitor
extends java.lang.Object
implements Monitor

A convenience stub for testing purpose or to disable monitoring without breaking the application.

Author:
Nicolas De Loof

Constructor Summary
NullMonitor(java.lang.String name)
           
 
Method Summary
 void add(long value)
          Convenience method to add a primitive numeric data to the monitor.
 void clear()
          Reset the monitor
 void fireMonitoringEvent(MonitoringEvent event)
          Dispatches the given MonitoringEvent to all registred listeners.
<T> T
getFeature(java.lang.Class<T> feature)
          To acces internal optional features or plugable extensions, application asks the monitor for the extension plublic API class.
 java.util.Set<java.lang.Class> getFeatures()
          
 java.lang.String getName()
          
 java.util.Set<java.lang.String> getTags()
          
 boolean hasFeatures(java.lang.Class[] features)
          
 boolean isFeatureSupported(java.lang.Class clazz)
          
 boolean isTagged(java.lang.String tag)
          
 void monitor(long value, java.lang.Object context)
          
 Monitor tag(java.lang.String tag)
          Tag the monitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullMonitor

public NullMonitor(java.lang.String name)
Method Detail

add

public void add(long value)
Convenience method to add a primitive numeric data to the monitor.

Specified by:
add in interface Monitor
Parameters:
value - to be monitored
See Also:
Monitor.add(long)

clear

public void clear()
Reset the monitor

Specified by:
clear in interface Monitor
See Also:
Monitor.clear()

fireMonitoringEvent

public void fireMonitoringEvent(MonitoringEvent event)
Dispatches the given MonitoringEvent to all registred listeners.

Specified by:
fireMonitoringEvent in interface Monitor
See Also:
org.jmonit.Monitor#fireEvent(org.jmonit.events.MonitoringEvent)

getFeature

public <T> T getFeature(java.lang.Class<T> feature)
To acces internal optional features or plugable extensions, application asks the monitor for the extension plublic API class. The returned object implements the requested class.

The monitor is expected to "do its best" to return the expected feature, including register new features on-demand. To check for a feature to be supported, use Monitor.isFeatureSupported(java.lang.Class).

Specified by:
getFeature in interface Monitor
Returns:
null if the monitor doesn't support the requested API
See Also:
Monitor.getFeature(java.lang.Class)

getFeatures

public java.util.Set<java.lang.Class> getFeatures()

Specified by:
getFeatures in interface Monitor
Returns:
all features supported by this monitor
See Also:
Monitor.getFeatures()

getName

public java.lang.String getName()

Specified by:
getName in interface Monitor
Returns:
the name of this monitor
See Also:
Monitor.getName()

getTags

public java.util.Set<java.lang.String> getTags()

Specified by:
getTags in interface Monitor
Returns:
the monitor tags
See Also:
Monitor.getTags()

hasFeatures

public boolean hasFeatures(java.lang.Class[] features)

Specified by:
hasFeatures in interface Monitor
Parameters:
features - a set of requiered features
Returns:
true if the feature are supported by the monitor
See Also:
Monitor.hasFeatures(java.lang.Class[])

isFeatureSupported

public boolean isFeatureSupported(java.lang.Class clazz)

Specified by:
isFeatureSupported in interface Monitor
Returns:
true if the feature is supported by the monitor
See Also:
Monitor.isFeatureSupported(java.lang.Class)

isTagged

public boolean isTagged(java.lang.String tag)

Specified by:
isTagged in interface Monitor
Parameters:
tag - tag to test
Returns:
true if the monitor is tagged
See Also:
Monitor.isTagged(java.lang.String)

monitor

public void monitor(long value,
                    java.lang.Object context)

See Also:
org.jmonit.Monitor#monitor(long, java.lang.Object)

tag

public Monitor tag(java.lang.String tag)
Tag the monitor

Specified by:
tag in interface Monitor
Parameters:
tag - the tag
Returns:
the tagged monitor
See Also:
Monitor.tag(java.lang.String)


Copyright © 2007 Nicolas De Loof. All Rights Reserved.