1 23 24 29 30 package com.sun.enterprise.admin.jmx.remote.server.callers; 31 32 import java.util.ArrayList ; 33 import java.util.logging.Logger ; 34 35 import javax.management.MBeanServerConnection ; 36 import javax.management.ObjectName ; 37 import javax.management.NotificationListener ; 38 import javax.management.remote.message.MBeanServerRequestMessage; 39 import javax.management.remote.message.MBeanServerResponseMessage; 40 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 RemoveNotifLsnrCaller extends AbstractMethodCaller { 52 53 private ServerNotificationManager notifyMgr = null; 54 55 private static final Logger logger = Logger.getLogger( 56 DefaultConfiguration.JMXCONNECTOR_LOGGER); 58 59 public RemoveNotifLsnrCaller(MBeanServerConnection mbsc, ServerNotificationManager mgr) { 60 super(mbsc); 61 METHOD_ID = MBeanServerRequestMessage.REMOVE_NOTIFICATION_LISTENER; 62 this.notifyMgr = mgr; 63 } 64 65 public MBeanServerResponseMessage call(MBeanServerRequestMessage request) { 66 Object result = null; 68 boolean isException = false; 69 70 ObjectName objname = (ObjectName ) request.getParams()[0]; 71 String cid = (String ) request.getParams()[1]; 72 String [] ids = (String []) request.getParams()[2]; 73 74 NotificationListener proxy = null; 75 try { 76 for (int i=0; i < ids.length; i++) { 77 proxy = (NotificationListener ) 78 notifyMgr.removeNotificationListener(objname, ids[i]); 79 mbsc.removeNotificationListener(objname, proxy); 80 } 81 } catch (Exception e) { 82 result = e; 83 isException = true; 84 } 85 return ( new MBeanServerResponseMessage(METHOD_ID, result, isException) ); 86 } 87 } 88 | Popular Tags |