|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.util.JBossNotificationBroadcasterSupport
org.jboss.system.ServiceMBeanSupport
org.jboss.system.ListenerServiceMBeanSupport
org.jboss.monitor.services.ScriptingListener
public class ScriptingListener
A simple listener that can subscribe for any combination of notifications, and asynchronously process them using a script written using any of the languages supported by the apache Bean Scripting Framework (BSF). The following variables are setup for the script to use: "log" - service Logger "server" - the MBeanServer "manager" - alarm manager helper "notification" - the Notification to be processed "handback" - the Object sent with the notification By setting up a Timer using the TimerService to periodicaly emit notifications, we can use those notifications as triggers for performing any sort of polling operation. One of the intented uses of this service is to use the "manager" (see org.jboss.monitor.alarm.AlarmManager) in the script, help maintain a list of active system alarms in the ActiveAlarmTable service.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jboss.system.ListenerServiceMBeanSupport |
---|
org.jboss.system.ListenerServiceMBeanSupport.SubscriptionInfo |
Field Summary |
---|
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
---|
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.system.ListenerServiceMBean |
---|
SL_FILTER_ELEMENT, SL_FILTER_FACTORY_ATTRIBUTE, SL_MBEAN_ELEMENT, SL_MBEAN_HANDBACK_ATTRIBUTE, SL_MBEAN_NAME_ATTRIBUTE, SL_NOTIFICATION_ELEMENT, SL_NOTIFICATION_TYPE_ATTRIBUTE, SL_ROOT_ELEMENT |
Fields inherited from interface org.jboss.system.ServiceMBean |
---|
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED |
Constructor Summary | |
---|---|
ScriptingListener()
CTOR |
Method Summary | |
---|---|
long |
getAverageProcessingTime()
The average notification processing time in msecs |
boolean |
getDynamicSubscriptions()
|
long |
getNotificationsProcessed()
The number of notification processed |
long |
getNotificationsReceived()
The number of notifications received |
String |
getScript()
|
String |
getScriptLanguage()
|
long |
getTotalProcessingTime()
The time spent processing notifications in msecs |
void |
handleNotification2(javax.management.Notification notification,
Object handback)
Overriden to add handling! |
void |
setDynamicSubscriptions(boolean dynamicSubscriptions)
Flag to enable/disable dynamic subscriptions |
void |
setScript(String script)
The script to execute when a notification is received |
void |
setScriptLanguage(String language)
The language the script is written into |
void |
startService()
Start |
void |
stopService()
Stop |
Methods inherited from class org.jboss.system.ListenerServiceMBeanSupport |
---|
handleNotification, setSubscriptionList, subscribe, subscribe, subscribe, unsubscribe |
Methods inherited from class org.jboss.system.ServiceMBeanSupport |
---|
create, createService, destroy, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop |
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport |
---|
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.system.ListenerServiceMBean |
---|
setSubscriptionList |
Methods inherited from interface org.jboss.system.ServiceMBean |
---|
getName, getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
---|
create, destroy, start, stop |
Constructor Detail |
---|
public ScriptingListener()
Method Detail |
---|
public void setScript(String script)
ScriptingListenerMBean
setScript
in interface ScriptingListenerMBean
public String getScript()
getScript
in interface ScriptingListenerMBean
public void setScriptLanguage(String language)
ScriptingListenerMBean
setScriptLanguage
in interface ScriptingListenerMBean
public String getScriptLanguage()
getScriptLanguage
in interface ScriptingListenerMBean
public void setDynamicSubscriptions(boolean dynamicSubscriptions)
ScriptingListenerMBean
setDynamicSubscriptions
in interface ScriptingListenerMBean
public boolean getDynamicSubscriptions()
getDynamicSubscriptions
in interface ScriptingListenerMBean
public long getNotificationsReceived()
ScriptingListenerMBean
getNotificationsReceived
in interface ScriptingListenerMBean
public long getNotificationsProcessed()
ScriptingListenerMBean
getNotificationsProcessed
in interface ScriptingListenerMBean
public long getTotalProcessingTime()
ScriptingListenerMBean
getTotalProcessingTime
in interface ScriptingListenerMBean
public long getAverageProcessingTime()
ScriptingListenerMBean
getAverageProcessingTime
in interface ScriptingListenerMBean
public void startService() throws Exception
startService
in class org.jboss.system.ServiceMBeanSupport
Exception
public void stopService() throws Exception
stopService
in class org.jboss.system.ServiceMBeanSupport
Exception
public void handleNotification2(javax.management.Notification notification, Object handback)
handleNotification2
in class org.jboss.system.ListenerServiceMBeanSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |