mx4j.monitor
Class MX4JMonitor

java.lang.Object
  extended byjavax.management.StandardMBean
      extended bymx4j.monitor.MX4JMonitor
All Implemented Interfaces:
javax.management.DynamicMBean, javax.management.MBeanRegistration, MX4JMonitorMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter
Direct Known Subclasses:
MX4JCounterMonitor, MX4JGaugeMonitor, MX4JStringMonitor

public abstract class MX4JMonitor
extends javax.management.StandardMBean
implements MX4JMonitorMBean, javax.management.MBeanRegistration, javax.management.NotificationEmitter

The class that implements the Monitor behavior of the JMX specification. IMPLEMENTATION NOTE: There is one single thread that handles monitoring, for all monitor objects. There is one single task per each monitor object that runs. The queue will have possibly many tasks per each monitor type. Each monitor handles many MBeans, but only one attribute; however, both MBeans and attribute can be changed, though it would be a strange way to use the monitor.

Version:
$Revision: 1.4 $

Nested Class Summary
protected  class MX4JMonitor.MonitorInfo
           
 
Constructor Summary
protected MX4JMonitor(java.lang.Class management)
           
 
Method Summary
 void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void addObservedObject(javax.management.ObjectName name)
           
 void clearObservedObjects()
           
 boolean containsObservedObject(javax.management.ObjectName name)
           
protected abstract  MX4JMonitor.MonitorInfo createMonitorInfo()
           
protected  javax.management.Notification createMonitorNotification(java.lang.String type, long sequence, java.lang.String message, javax.management.ObjectName observed, java.lang.String attribute, java.lang.Object gauge, java.lang.Object trigger)
           
protected  javax.management.NotificationBroadcasterSupport createNotificationEmitter()
           
 long getGranularityPeriod()
           
protected  Logger getLogger()
           
protected  MX4JMonitor.MonitorInfo getMonitorInfo(javax.management.ObjectName name)
           
 java.lang.String getObservedAttribute()
           
 javax.management.ObjectName[] getObservedObjects()
           
 boolean isActive()
           
protected abstract  void monitor(javax.management.ObjectName name, java.lang.String attribute, java.lang.Object value, MX4JMonitor.MonitorInfo info)
           
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
           
protected  void putMonitorInfo(javax.management.ObjectName name, MX4JMonitor.MonitorInfo info)
           
protected  void removeMonitorInfo(javax.management.ObjectName name)
           
 void removeNotificationListener(javax.management.NotificationListener listener)
           
 void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void removeObservedObject(javax.management.ObjectName name)
           
protected  void sendErrorNotification(MX4JMonitor.MonitorInfo info, java.lang.String type, java.lang.String message, javax.management.ObjectName observed, java.lang.String attribute)
           
 void sendNotification(javax.management.Notification notification)
           
protected  void sendNotification(java.lang.String type, java.lang.String message, javax.management.ObjectName name, java.lang.String attribute, java.lang.Object gauge, java.lang.Object trigger)
           
 void setGranularityPeriod(long granularity)
           
 void setObservedAttribute(java.lang.String attribute)
           
 void start()
           
protected  void startMonitor()
           
 void stop()
           
protected  void stopMonitor()
           
 
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, invoke, setAttribute, setAttributes, setImplementation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.NotificationBroadcaster
getNotificationInfo
 

Constructor Detail

MX4JMonitor

protected MX4JMonitor(java.lang.Class management)
               throws javax.management.NotCompliantMBeanException
Method Detail

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
Specified by:
preRegister in interface javax.management.MBeanRegistration

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
Specified by:
preDeregister in interface javax.management.MBeanRegistration

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

createNotificationEmitter

protected javax.management.NotificationBroadcasterSupport createNotificationEmitter()

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener listener,
                                    javax.management.NotificationFilter filter,
                                    java.lang.Object handback)
                             throws java.lang.IllegalArgumentException
Specified by:
addNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
java.lang.IllegalArgumentException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationBroadcaster
Throws:
javax.management.ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener,
                                       javax.management.NotificationFilter filter,
                                       java.lang.Object handback)
                                throws javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.NotificationEmitter
Throws:
javax.management.ListenerNotFoundException

sendNotification

public void sendNotification(javax.management.Notification notification)

start

public void start()
Specified by:
start in interface MX4JMonitorMBean

stop

public void stop()
Specified by:
stop in interface MX4JMonitorMBean

isActive

public boolean isActive()
Specified by:
isActive in interface MX4JMonitorMBean

addObservedObject

public void addObservedObject(javax.management.ObjectName name)
                       throws java.lang.IllegalArgumentException
Specified by:
addObservedObject in interface MX4JMonitorMBean
Throws:
java.lang.IllegalArgumentException

removeObservedObject

public void removeObservedObject(javax.management.ObjectName name)
Specified by:
removeObservedObject in interface MX4JMonitorMBean

containsObservedObject

public boolean containsObservedObject(javax.management.ObjectName name)
Specified by:
containsObservedObject in interface MX4JMonitorMBean

getObservedObjects

public javax.management.ObjectName[] getObservedObjects()
Specified by:
getObservedObjects in interface MX4JMonitorMBean

clearObservedObjects

public void clearObservedObjects()

getObservedAttribute

public java.lang.String getObservedAttribute()
Specified by:
getObservedAttribute in interface MX4JMonitorMBean

setObservedAttribute

public void setObservedAttribute(java.lang.String attribute)
Specified by:
setObservedAttribute in interface MX4JMonitorMBean

getGranularityPeriod

public long getGranularityPeriod()
Specified by:
getGranularityPeriod in interface MX4JMonitorMBean

setGranularityPeriod

public void setGranularityPeriod(long granularity)
                          throws java.lang.IllegalArgumentException
Specified by:
setGranularityPeriod in interface MX4JMonitorMBean
Throws:
java.lang.IllegalArgumentException

startMonitor

protected void startMonitor()

stopMonitor

protected void stopMonitor()

getLogger

protected Logger getLogger()

sendNotification

protected void sendNotification(java.lang.String type,
                                java.lang.String message,
                                javax.management.ObjectName name,
                                java.lang.String attribute,
                                java.lang.Object gauge,
                                java.lang.Object trigger)

createMonitorNotification

protected javax.management.Notification createMonitorNotification(java.lang.String type,
                                                                  long sequence,
                                                                  java.lang.String message,
                                                                  javax.management.ObjectName observed,
                                                                  java.lang.String attribute,
                                                                  java.lang.Object gauge,
                                                                  java.lang.Object trigger)

monitor

protected abstract void monitor(javax.management.ObjectName name,
                                java.lang.String attribute,
                                java.lang.Object value,
                                MX4JMonitor.MonitorInfo info)

createMonitorInfo

protected abstract MX4JMonitor.MonitorInfo createMonitorInfo()

getMonitorInfo

protected MX4JMonitor.MonitorInfo getMonitorInfo(javax.management.ObjectName name)

putMonitorInfo

protected void putMonitorInfo(javax.management.ObjectName name,
                              MX4JMonitor.MonitorInfo info)

removeMonitorInfo

protected void removeMonitorInfo(javax.management.ObjectName name)

sendErrorNotification

protected void sendErrorNotification(MX4JMonitor.MonitorInfo info,
                                     java.lang.String type,
                                     java.lang.String message,
                                     javax.management.ObjectName observed,
                                     java.lang.String attribute)


Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.