mx4j.monitor

Class MX4JMonitor

Implemented Interfaces:
javax.management.MBeanRegistration, MX4JMonitorMBean, javax.management.NotificationEmitter
Known Direct 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

MX4JMonitor(Class management)

Method Summary

void
addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, 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(String type, long sequence, String message, javax.management.ObjectName observed, String attribute, Object gauge, Object trigger)
protected javax.management.NotificationBroadcasterSupport
createNotificationEmitter()
long
getGranularityPeriod()
protected Logger
getLogger()
protected MX4JMonitor.MonitorInfo
getMonitorInfo(javax.management.ObjectName name)
String
getObservedAttribute()
javax.management.ObjectName[]
getObservedObjects()
boolean
isActive()
protected abstract void
monitor(javax.management.ObjectName name, String attribute, Object value, MX4JMonitor.MonitorInfo info)
void
postDeregister()
void
postRegister(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, Object handback)
void
removeObservedObject(javax.management.ObjectName name)
protected void
sendErrorNotification(MX4JMonitor.MonitorInfo info, String type, String message, javax.management.ObjectName observed, String attribute)
protected void
sendNotification(String type, String message, javax.management.ObjectName name, String attribute, Object gauge, Object trigger)
void
sendNotification(javax.management.Notification notification)
void
setGranularityPeriod(long granularity)
void
setObservedAttribute(String attribute)
void
start()
protected void
startMonitor()
void
stop()
protected void
stopMonitor()

Constructor Details

MX4JMonitor

protected MX4JMonitor(Class management)
            throws javax.management.NotCompliantMBeanException

Method Details

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener listener,
                                    javax.management.NotificationFilter filter,
                                    Object handback)
            throws IllegalArgumentException

addObservedObject

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

clearObservedObjects

public void clearObservedObjects()

containsObservedObject

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

createMonitorInfo

protected abstract MX4JMonitor.MonitorInfo createMonitorInfo()

createMonitorNotification

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

createNotificationEmitter

protected javax.management.NotificationBroadcasterSupport createNotificationEmitter()

getGranularityPeriod

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

getLogger

protected Logger getLogger()

getMonitorInfo

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

getObservedAttribute

public String getObservedAttribute()
Specified by:
getObservedAttribute in interface MX4JMonitorMBean

getObservedObjects

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

isActive

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

monitor

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

postDeregister

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

postRegister

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

preDeregister

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

preRegister

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

putMonitorInfo

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

removeMonitorInfo

protected void removeMonitorInfo(javax.management.ObjectName name)

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener)
            throws javax.management.ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(javax.management.NotificationListener listener,
                                       javax.management.NotificationFilter filter,
                                       Object handback)
            throws javax.management.ListenerNotFoundException

removeObservedObject

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

sendErrorNotification

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

sendNotification

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

sendNotification

public void sendNotification(javax.management.Notification notification)

setGranularityPeriod

public void setGranularityPeriod(long granularity)
            throws IllegalArgumentException
Specified by:
setGranularityPeriod in interface MX4JMonitorMBean

setObservedAttribute

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

start

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

startMonitor

protected void startMonitor()

stop

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

stopMonitor

protected void stopMonitor()

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