javax.management.NotificationFilterSupport Java Examples
The following examples show how to use
javax.management.NotificationFilterSupport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluggableMBeanServerTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testNotificationTccl() throws Exception { ObjectName objName = createName("test.domain:bean=test-tccl"); server.registerMBean(new TestBean(objName), objName); ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); ClassLoader newOutTccl = new URLClassLoader(new URL[]{}, oldTccl); // creating a new class loader here WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(newOutTccl); try { final AtomicBoolean differ = new AtomicBoolean(false); NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType("testtccl"); server.addNotificationListener(objName, new NotificationListener() { @Override public void handleNotification(Notification notification, Object handback) { Assert.assertEquals("callback", handback.toString()); ClassLoader newInTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); Assert.assertNotEquals(newInTccl, newOutTccl); differ.set(true); } }, filter, "callback"); server.invoke(objName, "proceed", null, null); Assert.assertTrue(differ.get()); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }
Example #2
Source File: ModelControllerMBeanTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private void doTestMBeanServerNotification_UNREGISTRATION_NOTIFICATION(MBeanServerConnection connection, boolean mustReceiveNotification) throws Exception { final ObjectName testObjectName = createObjectName(LEGACY_DOMAIN + ":subsystem=test"); final ObjectName childObjectName = createObjectName(LEGACY_DOMAIN + ":subsystem=test,single=only"); final CountDownLatch notificationEmitted = new CountDownLatch(1); final AtomicReference<Notification> notification = new AtomicReference<>(); NotificationListener listener = new MbeanServerNotificationListener(notification, notificationEmitted, LEGACY_DOMAIN); NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION); connection.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, filter, null); // add a management resource connection.invoke(testObjectName, "addSingleOnly", new Object[]{123}, new String[]{String.class.getName()}); // and remove it connection.invoke(childObjectName, "remove", new Object[0], new String[0]); if (mustReceiveNotification) { Assert.assertTrue("Did not receive expected notification", notificationEmitted.await(1, TimeUnit.SECONDS)); Notification notif = notification.get(); Assert.assertNotNull(notif); Assert.assertTrue(notif instanceof MBeanServerNotification); MBeanServerNotification mBeanServerNotification = (MBeanServerNotification) notif; Assert.assertEquals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION, mBeanServerNotification.getType()); Assert.assertEquals(childObjectName, mBeanServerNotification.getMBeanName()); } else { Assert.assertFalse("Did receive unexpected notification", notificationEmitted.await(500, TimeUnit.MILLISECONDS)); } connection.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, filter, null); }
Example #3
Source File: JmxBuilderModelMBean.java From groovy with Apache License 2.0 | 6 votes |
/** * Sets up event listeners for this MBean as described in the descriptor. * The descriptor contains a map with layout * {item -> Map[event:"...", from:ObjectName, callback:&Closure],...,} * * @param server the MBeanServer is to be registered. * @param descriptor a map containing info about the event */ public void addEventListeners(MBeanServer server, Map<String, Map<String, Object>> descriptor) { for (Map.Entry<String, Map<String, Object>> item : descriptor.entrySet()) { Map<String, Object> listener = item.getValue(); // register with server ObjectName broadcaster = (ObjectName) listener.get("from"); try { String eventType = (String) listener.get("event"); if (eventType != null) { NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(eventType); server.addNotificationListener(broadcaster, JmxEventListener.getListener(), filter, listener); } else { server.addNotificationListener(broadcaster, JmxEventListener.getListener(), null, listener); } } catch (InstanceNotFoundException e) { throw new JmxBuilderException(e); } } }
Example #4
Source File: RMIConnector.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #5
Source File: ClientGui.java From logging-log4j2 with Apache License 2.0 | 5 votes |
private void registerListeners(final StatusLoggerAdminMBean status) throws InstanceNotFoundException, MalformedObjectNameException, IOException { final NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE); final ObjectName objName = status.getObjectName(); // System.out.println("Add listener for " + objName); client.getConnection().addNotificationListener(objName, this, filter, status.getContextName()); }
Example #6
Source File: ClientGui.java From logging-log4j2 with Apache License 2.0 | 5 votes |
public ClientGui(final Client client) throws IOException, JMException { this.client = Objects.requireNonNull(client, "client"); createWidgets(); populateWidgets(); // register for Notifications if LoggerContext MBean was added/removed final ObjectName addRemoveNotifs = MBeanServerDelegate.DELEGATE_NAME; final NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(Server.DOMAIN); // only interested in Log4J2 MBeans client.getConnection().addNotificationListener(addRemoveNotifs, this, null, null); }
Example #7
Source File: ModelControllerMBeanTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
public void doTestMBeanServerNotification_REGISTRATION_NOTIFICATION(MBeanServerConnection connection, boolean mustReceiveNotification) throws Exception { final ObjectName testObjectName = createObjectName(LEGACY_DOMAIN + ":subsystem=test"); final ObjectName childObjectName = createObjectName(LEGACY_DOMAIN + ":subsystem=test,single=only"); final CountDownLatch notificationEmitted = new CountDownLatch(1); final AtomicReference<Notification> notification = new AtomicReference<>(); NotificationListener listener = new MbeanServerNotificationListener(notification, notificationEmitted, LEGACY_DOMAIN); NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION); connection.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, filter, null); // add a management resource connection.invoke(testObjectName, "addSingleOnly", new Object[]{123}, new String[]{String.class.getName()}); if (mustReceiveNotification) { Assert.assertTrue("Did not receive expected notification", notificationEmitted.await(1, TimeUnit.SECONDS)); Notification notif = notification.get(); Assert.assertNotNull(notif); Assert.assertTrue(notif instanceof MBeanServerNotification); MBeanServerNotification mBeanServerNotification = (MBeanServerNotification) notif; Assert.assertEquals(MBeanServerNotification.REGISTRATION_NOTIFICATION, notif.getType()); Assert.assertEquals(childObjectName, mBeanServerNotification.getMBeanName()); } else { Assert.assertFalse("Did receive unexpected notification", notificationEmitted.await(500, TimeUnit.MILLISECONDS)); } connection.removeNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, filter, null); }
Example #8
Source File: JmxNotificationFilters.java From brooklyn-server with Apache License 2.0 | 5 votes |
/** * Matches any of the given notification types. * @see {@link NotificationFilterSupport#enableType(String)} */ public static NotificationFilter matchesTypes(String... types) { NotificationFilterSupport result = new NotificationFilterSupport(); for (String type : types) { result.enableType(type); } return result; }
Example #9
Source File: RMIConnector.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #10
Source File: RMIConnector.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #11
Source File: JmxBuilderModelMBean.java From groovy with Apache License 2.0 | 5 votes |
/** * 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 * {@code 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); } } } }
Example #12
Source File: JMXHelper.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * the INITTASKS calling connectToDS across ThreadGroups * should be executed with the keyword SEQUENTIAL * <p> * Must be invoked after the JMX agents have been created, started, and * connected using {@link hydra.AgentHelper}. */ public static void connectToDS() throws Exception { // Connect To DS connectToDSButDoNotAttachListeners(); //Register the stat alert notification listener as well. listener = new StatAlertNotificationListener(40); NotificationFilterSupport support = new NotificationFilterSupport(); support.enableType(AdminDistributedSystemJmxImpl.NOTIF_STAT_ALERT); mbsc.addNotificationListener(distributedSys, listener, support, new Object()); logger.info("Connected to JMX ADS " + distributedSys); }
Example #13
Source File: RMIConnector.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #14
Source File: RMIConnector.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #15
Source File: JMXHelper.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * the INITTASKS calling connectToDS across ThreadGroups * should be executed with the keyword SEQUENTIAL * <p> * Must be invoked after the JMX agents have been created, started, and * connected using {@link hydra.AgentHelper}. */ public static void connectToDS() throws Exception { // Connect To DS connectToDSButDoNotAttachListeners(); //Register the stat alert notification listener as well. listener = new StatAlertNotificationListener(40); NotificationFilterSupport support = new NotificationFilterSupport(); support.enableType(AdminDistributedSystemJmxImpl.NOTIF_STAT_ALERT); mbsc.addNotificationListener(distributedSys, listener, support, new Object()); logger.info("Connected to JMX ADS " + distributedSys); }
Example #16
Source File: RMIConnector.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #17
Source File: RMIConnector.java From hottub with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #18
Source File: RMIConnector.java From Java8CN with Apache License 2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #19
Source File: RMIConnector.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #20
Source File: RMIConnector.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #21
Source File: RMIConnector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #22
Source File: RMIConnector.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #23
Source File: RMIConnector.java From JDKSourceCode1.8 with MIT License | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #24
Source File: RMIConnector.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #25
Source File: RMIConnector.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }
Example #26
Source File: RMIConnector.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected Integer addListenerForMBeanRemovedNotif() throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = new NotificationFilterSupport(); clientFilter.enableType( MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject<NotificationFilter> sFilter = new MarshalledObject<NotificationFilter>(clientFilter); Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; final MarshalledObject<NotificationFilter>[] filters = Util.cast(new MarshalledObject<?>[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = connection.addNotificationListeners(names, filters, subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = connection.addNotificationListeners(names, filters, subjects); } return listenerIDs[0]; }