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:gov.nih.nci.cabig.caaers.tools.JMXBeansRegistrar.java
public void destroy() throws Exception { try {// w w w .java 2 s.c o m MBeanServer server = ManagementFactory.getPlatformMBeanServer(); for (SessionFactory sf : sessionFactories) { ObjectName on = prepareObjectName(sf); server.unregisterMBean(on); } } catch (Exception e) { log.error("Unable to unregister MBeans"); log.error(ExceptionUtils.getFullStackTrace(e)); } }
From source file:org.apache.james.modules.server.JMXServer.java
private void doStop() { try {/*ww w.ja v a 2s. c o m*/ MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); registeredKeys.forEach(key -> { try { mBeanServer.unregisterMBean(new ObjectName(key)); } catch (Exception e) { throw Throwables.propagate(e); } }); registeredKeys.clear(); jmxConnectorServer.stop(); } catch (IOException e) { throw Throwables.propagate(e); } }
From source file:org.chorusbdd.chorus.tools.webagent.WebAgentSuiteListener.java
public void stop() throws IOException { log.info(this + " stopping MBean server"); MBeanServer mBeanServer = jmxManagementServerExporter.getmBeanServer(); try {/*from www . ja va 2 s .com*/ mBeanServer.unregisterMBean(new ObjectName(RemoteExecutionListenerMBean.JMX_EXECUTION_LISTENER_NAME)); } catch (Exception e) { log.error("Failed to unregister jmx execution listener", e); } jmxManagementServerExporter.stopServer(); }
From source file:org.sakaiproject.kernel.loader.server.test.DummySharedClassLoaderContainer.java
/** * Stop the classloader container, removing the MBean from the MBean server. * @see org.sakaiproject.kernel.api.RequiresStop#stop() *///from w w w . j a v a 2s . c o m public void stop() { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName common = new ObjectName(CommonObject.MBEAN_COMMON + ".sharedclassloader"); mbs.unregisterMBean(common); LOG.info("Shared Classloader Container stopped Ok"); } catch (JMException e) { LOG.info( "Cant stop the shared classloader bean, this will cause problems if the kernel is restarted in this jvm " + e.getMessage(), e); } }
From source file:org.apache.synapse.securevault.commons.MBeanRegistrar.java
public void unRegisterMBean(String category, String id) { try {//from w w w . j a v a2s . c o m MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(getObjectName(category, id)); if (mbs.isRegistered(objName)) { mbs.unregisterMBean(objName); } } catch (Exception e) { log.warn("Error un-registering a MBean with name ' " + id + " ' and category name ' " + category + "' for JMX management", e); } }
From source file:org.cloudata.core.common.metrics.CloudataMetricsFactory.java
public void unregisterMBean(ObjectName mbeanName) { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbeanName == null) return;// w w w.j ava2s .c o m try { mbs.unregisterMBean(mbeanName); } catch (InstanceNotFoundException e) { // ignore } catch (Exception e) { e.printStackTrace(); } }
From source file:org.sakaiproject.kernel.component.core.SharedClassLoaderContainer.java
/** * Stop the classloader container, removing the MBean from the MBean server. * @see org.sakaiproject.kernel.api.RequiresStop#stop() *//*www . j a v a 2 s .c om*/ public void stop() { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName common = new ObjectName(CommonObject.MBEAN_COMMON + ".sharedclassloader"); mbs.unregisterMBean(common); LOG.info("Shared Classloader Container stopped Ok"); } catch (JMException e) { LOG.debug( "Cant stop the shared classloader bean, this will cause problems if the kernel is restarted in this jvm " + e.getMessage(), e); } }
From source file:org.apache.synapse.commons.jmx.MBeanRegistrar.java
public boolean unRegisterMBean(String category, String id) { try {//from w w w .j a v a2 s . co m MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName objName = new ObjectName(getObjectName(category, id)); if (mbs.isRegistered(objName)) { mbs.unregisterMBean(objName); return true; } } catch (Exception e) { log.warn("Error un-registering a MBean with name ' " + id + " ' and category name ' " + category + "' for JMX management", e); } return false; }
From source file:org.nuxeo.ecm.automation.core.AutomationComponent.java
protected void unBindManagement() throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException, InstanceNotFoundException { final ObjectName on = new ObjectName("org.nuxeo.automation:name=tracerfactory"); final ServerLocator locator = Framework.getLocalService(ServerLocator.class); if (locator != null) { MBeanServer mBeanServer = locator.lookupServer(); mBeanServer.unregisterMBean(on); }/* w ww . j av a 2s . co m*/ }
From source file:org.jmxtrans.embedded.util.pool.ManagedGenericKeyedObjectPoolTest.java
@Test public void testMbeanAttributeAccess() throws Exception { BaseKeyedPooledObjectFactory<String, String> factory = new BaseKeyedPooledObjectFactory<String, String>() { @Override//from w ww . j a v a 2 s. c o m public String create(String key) throws Exception { return key; } @Override public PooledObject<String> wrap(String value) { return new DefaultPooledObject<String>(value); } }; GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setJmxNameBase("org.jmxtrans.embedded:type=GenericKeyedObjectPool,writer=MyWriter,name="); config.setJmxNamePrefix("my-host_1234"); GenericKeyedObjectPool<String, String> objectPool = new GenericKeyedObjectPool<String, String>(factory, config); ObjectName objectName = new ObjectName( "org.jmxtrans.embedded:type=GenericKeyedObjectPool,writer=MyWriter,name=my-host_1234"); MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); try { Object numIdle = mbeanServer.getAttribute(objectName, "NumIdle"); assertThat(numIdle, instanceOf(Number.class)); } finally { mbeanServer.unregisterMBean(objectName); } }