1203 }
1204
1205 public void addNotificationListener(ObjectName name,
1206 ObjectName listener,
1207 NotificationFilter filter,
1208 Object handback)
1209 throws InstanceNotFoundException {
1210
1211 // ------------------------------
1212 // ------------------------------
1213
1214 // ----------------
1215 // Get listener object
1216 // ----------------
1217 DynamicMBean instance = getMBean(listener);
1218 Object resource = getResource(instance);
1219 if (!(resource instanceof NotificationListener)) {
1220 throw new RuntimeOperationsException(new
1221 IllegalArgumentException(listener.getCanonicalName()),
1222 "The MBean " + listener.getCanonicalName() +
1223 "does not implement the NotificationListener interface") ;
1224 }
1225
1226 // ----------------
1227 // Add a listener on an MBean
1228 // ----------------
1229 if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
1230 MBEANSERVER_LOGGER.logp(Level.FINER,
1231 DefaultMBeanServerInterceptor.class.getName(),
1232 "addNotificationListener",
1233 "ObjectName = " + name + ", Listener = " + listener);
1234 }
1235 server.addNotificationListener(name,(NotificationListener) resource,
1236 filter, handback) ;
1237 }
1238
1239 public void removeNotificationListener(ObjectName name,
1240 NotificationListener listener)
1241 throws InstanceNotFoundException, ListenerNotFoundException {
1242 removeNotificationListener(name, listener, null, null, true);
1243 }
|
1203 }
1204
1205 public void addNotificationListener(ObjectName name,
1206 ObjectName listener,
1207 NotificationFilter filter,
1208 Object handback)
1209 throws InstanceNotFoundException {
1210
1211 // ------------------------------
1212 // ------------------------------
1213
1214 // ----------------
1215 // Get listener object
1216 // ----------------
1217 DynamicMBean instance = getMBean(listener);
1218 Object resource = getResource(instance);
1219 if (!(resource instanceof NotificationListener)) {
1220 throw new RuntimeOperationsException(new
1221 IllegalArgumentException(listener.getCanonicalName()),
1222 "The MBean " + listener.getCanonicalName() +
1223 " does not implement the NotificationListener interface") ;
1224 }
1225
1226 // ----------------
1227 // Add a listener on an MBean
1228 // ----------------
1229 if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
1230 MBEANSERVER_LOGGER.logp(Level.FINER,
1231 DefaultMBeanServerInterceptor.class.getName(),
1232 "addNotificationListener",
1233 "ObjectName = " + name + ", Listener = " + listener);
1234 }
1235 server.addNotificationListener(name,(NotificationListener) resource,
1236 filter, handback) ;
1237 }
1238
1239 public void removeNotificationListener(ObjectName name,
1240 NotificationListener listener)
1241 throws InstanceNotFoundException, ListenerNotFoundException {
1242 removeNotificationListener(name, listener, null, null, true);
1243 }
|