/**
* Registers listeners for operation calls (i.e. method, getter, and setter calls) when
* invoked on this bean from the MBeanServer. Descriptor should contain a map with layout
* item -> [Map[methodListener:[target:"", tpe:"", callback:&Closure], ... ,]]
*
* @param descriptor MetaMap descriptor containing description of operation call listeners
*/
public void addOperationCallListeners(Map<String, Map<String, Map<String, Object>>> descriptor) {
if (descriptor == null) return;
for (Map.Entry<String, Map<String, Map<String, Object>>> item : descriptor.entrySet()) {
// set up method listeners (such as attributeListener and Operation Listeners)
// item -> [Map[methodListener:[target:"", tpe:"", callback:&Closure], ... ,]]
if (item.getValue().containsKey("methodListener")) {
Map<String, Object> listener = item.getValue().get("methodListener");
String target = (String) listener.get("target");
methodListeners.add(target);
String listenerType = (String) listener.get("type");
listener.put("managedObject", this.managedObject);
// register an attribute change notification listener with model mbean
if (listenerType.equals("attributeChangeListener")) {
try {
this.addAttributeChangeNotificationListener(
AttributeChangedListener.getListener(), (String) listener.get("attribute"), listener
);
} catch (MBeanException e) {
throw new JmxBuilderException(e);
}
}
if (listenerType.equals("operationCallListener")) {
String eventType = "jmx.operation.call." + target;
NotificationFilterSupport filter = new NotificationFilterSupport();
filter.enableType(eventType);
this.addNotificationListener(JmxEventListener.getListener(), filter, listener);
}
}
}
}
JmxBuilderModelMBean.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:groovy
作者:
评论列表
文章目录