1 23 24 29 30 31 package com.sun.enterprise.admin.jmx.remote.server.callers; 32 33 import java.util.logging.Logger ; 34 35 import javax.management.MBeanServerConnection ; 36 import javax.management.ObjectName ; 37 import javax.management.remote.message.MBeanServerRequestMessage; 38 import javax.management.remote.message.MBeanServerResponseMessage; 39 40 import com.sun.enterprise.admin.jmx.remote.server.notification.NotificationListenerProxy; 41 import com.sun.enterprise.admin.jmx.remote.server.notification.ServerNotificationManager; 42 import com.sun.enterprise.admin.jmx.remote.DefaultConfiguration; 43 44 50 51 public class AddNotifLsnrsCaller extends AbstractMethodCaller { 52 53 private ServerNotificationManager notifyMgr = null; 54 55 private final Logger logger = Logger.getLogger( 56 DefaultConfiguration.JMXCONNECTOR_LOGGER); 58 59 public AddNotifLsnrsCaller(MBeanServerConnection mbsc, ServerNotificationManager mgr) { 60 super(mbsc); 61 METHOD_ID = MBeanServerRequestMessage.ADD_NOTIFICATION_LISTENERS; 62 this.notifyMgr = mgr; 63 } 64 65 public MBeanServerResponseMessage call(MBeanServerRequestMessage request) { 66 Object result = null; 68 boolean isException = false; 69 ObjectName objname = (ObjectName )request.getParams()[0]; 70 String cid = (String ) request.getParams()[1]; 71 String id = (String ) request.getParams()[2]; 72 NotificationListenerProxy proxy = 73 new NotificationListenerProxy( objname, 74 notifyMgr, 75 cid); 76 notifyMgr.addNotificationListener(objname, id, proxy); 77 78 try { 79 mbsc.addNotificationListener(objname, proxy, null, null); 80 } catch (Exception e) { 81 isException = true; 82 result = e; 83 } 84 85 return ( new MBeanServerResponseMessage(METHOD_ID, result, isException) ); 86 } 87 } 88 | Popular Tags |