List of usage examples for javax.management MBeanServer unregisterMBean
public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException;
If this method successfully unregisters an MBean, a notification is sent as described above.
From source file:com.amazonaws.client.metrics.jmx.MBeans.java
/** * Unregisters the MBean under the given object name to the first MBean * server, or the platform MBean server if there is no explicitly registered * MBean server.//from w w w.j a v a 2 s . com * * @return true if the unregistration succeeded, or false if the MBean * doesn't exist under the given object name. * @throws MBeanRegistrationException * Wraps exceptions thrown by the preRegister(), preDeregister() * methods of the MBeanRegistration interface. */ public static <T> boolean unregisterMBean(String objectName) throws MBeanRegistrationException { MBeanServer server = getMBeanServer(); try { server.unregisterMBean(new ObjectName(objectName)); } catch (MalformedObjectNameException e) { throw new IllegalArgumentException(e); } catch (InstanceNotFoundException e) { LogFactory.getLog(MBeans.class).debug("Failed to unregister mbean " + objectName, e); return false; } return true; }
From source file:com.linuxbox.util.MBeanUtils.java
public static void unregisterMBean(ObjectName name) { if (name == null) { return;/*from ww w . j a v a 2 s . com*/ } try { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); server.unregisterMBean(name); } catch (MBeanRegistrationException e) { LOGGER.error("could not unregister mbean " + name, e); } catch (InstanceNotFoundException e) { LOGGER.error("could not find mbean " + name, e); } }
From source file:Main.java
static public void unregisterMBean(ObjectName mbeanName) { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbeanName == null) return;/*from w w w . j a v a2 s. c om*/ try { mbs.unregisterMBean(mbeanName); } catch (InstanceNotFoundException e) { // ignore } catch (Exception e) { e.printStackTrace(); } }
From source file:com.netflix.config.jmx.ConfigJMXManager.java
public static void unRegisterConfigMBean(AbstractConfiguration config, ConfigMBean mbean) { if (mbean == null) { throw new RuntimeException("Cannot unregister JMX Mbean. The object is null"); }/* www .j a va 2s . c o m*/ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { mbs.unregisterMBean(getJMXObjectName(config, mbean)); } catch (InstanceNotFoundException e) { throw new RuntimeException("InstanceNotFoundException", e); } catch (MBeanRegistrationException e) { throw new RuntimeException("MBeanRegistrationException", e); } catch (Exception e) { throw new RuntimeException("unRegisterConfigMBeanException", e); } }
From source file:org.wso2.carbon.utils.MBeanRegistrar.java
public static void unregisterAllMBeans() { MBeanServer mbs = ManagementFactory.getMBeanServer(); for (ObjectName name : mbeans) { try {// w w w . j a v a2 s. c o m mbs.unregisterMBean(name); } catch (Exception e) { log.error("Cannot unregister MBean " + name.getCanonicalName()); } } }
From source file:co.runrightfast.core.utils.JmxUtils.java
static void unregisterApplicationMBean(final String domain, final Class<?> mbeanType) { final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); try {/* w ww . jav a 2 s . com*/ mbeanServer.unregisterMBean(applicationMBeanObjectName(domain, mbeanType)); } catch (final InstanceNotFoundException | MBeanRegistrationException ex) { final Logger log = Logger.getLogger(JmxUtils.class.getName()); log.logp(WARNING, JmxUtils.class.getName(), "unregisterApplicationMBean", "failed", ex); } }
From source file:com.zavakid.mushroom.util.MBeans.java
static public void unregister(ObjectName mbeanName) { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbeanName == null) return;//w w w . ja v a2 s. c om try { mbs.unregisterMBean(mbeanName); } catch (InstanceNotFoundException e) { LOG.warn(mbeanName, e); } catch (Exception e) { LOG.warn("Error unregistering " + mbeanName, e); } }
From source file:org.apache.camel.TestSupportJmxCleanup.java
public static void removeMBeans(String domain) throws Exception { MBeanServer mbsc = ManagementFactory.getPlatformMBeanServer(); Set<ObjectName> s = mbsc.queryNames(new ObjectName(getDomainName(domain) + ":*"), null); for (ObjectName on : s) { mbsc.unregisterMBean(on); }//from w ww . ja va2 s. co m }
From source file:org.opendaylight.infrautils.diagstatus.MBeanUtils.java
public static void unregisterServerMBean(Object mxBeanImplementor, String objNameStr) throws MalformedObjectNameException, InstanceNotFoundException, MBeanRegistrationException { LOG.debug("unregister MXBean for {}", objNameStr); MBeanServer mplatformMbeanServer = ManagementFactory.getPlatformMBeanServer(); try {/* www . ja v a2 s . co m*/ mplatformMbeanServer.unregisterMBean(new ObjectName(objNameStr)); } catch (InstanceNotFoundException | MalformedObjectNameException | MBeanRegistrationException e) { LOG.error("Error while unregistering MBean {}", objNameStr, e); throw e; } }
From source file:com.espertech.esper.metrics.jmx.CommonJMXUtil.java
public static void unregisterMbean(MBeanServer server, ObjectName name) { try {//from w w w . jav a 2 s . c om server.unregisterMBean(name); } catch (Exception e) { log.error("Error unregistering mbean: " + e.getMessage(), e); } }