public void unregisterMBean() { try { if (registered) { ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name)); MonitoringServices.getInstance().removePerfNotificationListener(this); } this.registered = false; } catch (InstanceNotFoundException | MBeanRegistrationException | MalformedObjectNameException ex) { ex.printStackTrace(); } }
public void unregisterMBean() { try { if (registered) { ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name)); MonitoringServices.getInstance().removePerfNotificationListener(this); } this.registered = false; } catch (InstanceNotFoundException | MBeanRegistrationException | MalformedObjectNameException ex) { ex.printStackTrace(); } }
private void registerMBean() { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName mxbeanName = new ObjectName(name); mbs.registerMBean(this, mxbeanName); MonitoringServices.getInstance().addPerfNotificationListener(this, name); this.registered = true; } catch (InstanceAlreadyExistsException ex) { throw new RuntimeException(ex); } catch (MBeanRegistrationException ex) { ex.printStackTrace(); } catch (NotCompliantMBeanException | MalformedObjectNameException ex) { throw new AssertionError(ex); } }
private void registerMBean() { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName mxbeanName = new ObjectName(name); if (mbs.isRegistered(mxbeanName)) { try { LOG.info("MBean named {} is already registered. Unregistering it.", name); mbs.unregisterMBean(mxbeanName); } catch (InstanceNotFoundException e) { } } mbs.registerMBean(this, mxbeanName); MonitoringServices.getInstance().addPerfNotificationListener(this, name); this.registered = true; } catch (InstanceAlreadyExistsException ex) { throw new RuntimeException(ex); } catch (MBeanRegistrationException ex) { ex.printStackTrace(); } catch (NotCompliantMBeanException | MalformedObjectNameException ex) { throw new AssertionError(ex); } }
@SuppressWarnings({"CallToPrintStackTrace", "CallToThreadDumpStack"}) protected void registerMBean() { try { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); final ObjectName mxbeanName = new ObjectName(mbeanName); mbs.registerMBean(this, mxbeanName); this.registered = true; } catch (InstanceAlreadyExistsException ex) { throw new RuntimeException(ex); } catch (MBeanRegistrationException ex) { ex.printStackTrace(); } catch (NotCompliantMBeanException ex) { throw new AssertionError(ex); } catch (MalformedObjectNameException ex) { throw new AssertionError(ex); } MonitoringServices.getInstance().addPerfNotificationListener(this, mbeanName); }
@SuppressWarnings({"CallToPrintStackTrace", "CallToThreadDumpStack"}) private void registerMBean() { try { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); final ObjectName mxbeanName = new ObjectName(mbeanName); mbs.registerMBean(this, mxbeanName); this.registered = true; } catch (InstanceAlreadyExistsException ex) { throw new RuntimeException(ex); } catch (MBeanRegistrationException ex) { ex.printStackTrace(); } catch (NotCompliantMBeanException ex) { throw new AssertionError(ex); } catch (MalformedObjectNameException ex) { throw new AssertionError(ex); } MonitoringServices.getInstance().addPerfNotificationListener(this, mbeanName); }
@SuppressWarnings({"CallToPrintStackTrace", "CallToThreadDumpStack"}) @Override public void unregister() { try { if (registered) { MonitoringServices.getInstance().removePerfNotificationListener(this); ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(mbeanName)); } this.registered = false; } catch (InstanceNotFoundException ex) { ex.printStackTrace(); } catch (MBeanRegistrationException ex) { ex.printStackTrace(); } catch (MalformedObjectNameException ex) { throw new AssertionError(ex); } }
@SuppressWarnings({"CallToPrintStackTrace", "CallToThreadDumpStack"}) private void unregister() { try { if (registered) { MonitoringServices.getInstance().removePerfNotificationListener(this); ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(mbeanName)); } this.registered = false; } catch (InstanceNotFoundException ex) { ex.printStackTrace(); } catch (MBeanRegistrationException ex) { ex.printStackTrace(); } catch (MalformedObjectNameException ex) { throw new AssertionError(ex); } }