List of usage examples for javax.management MBeanServer getMBeanCount
public Integer getMBeanCount();
From source file:com.flexive.shared.mbeans.MBeanHelper.java
public static MBeanServer locateServer() { final List<MBeanServer> servers = findMBeanServers(); if (LOG.isInfoEnabled()) for (MBeanServer server : servers) { LOG.info("MBeanServer: " + server.getDefaultDomain() + "/" + server.getMBeanCount()); }/*from w w w . ja v a 2 s . c o m*/ return servers.get(0); }
From source file:org.wso2.carbon.kernel.jmx.MBeanRegistratorTest.java
@Test() public void testRegisterMBean() { MBeanServer mBeanServer = MBeanManagementFactory.getMBeanServer(); initialMBeanCount = mBeanServer.getMBeanCount(); MBeanRegistrator.registerMBean(new TransportManager()); Assert.assertTrue(mBeanServer.getMBeanCount() == initialMBeanCount + 1); String className = new TransportManager().getClass().getName(); if (className.indexOf('.') != -1) { className = className.substring(className.lastIndexOf('.') + 1); }// w w w. ja v a2 s .c o m String objectName = Constants.SERVER_PACKAGE + ":type=" + className; try { Assert.assertNotNull(mBeanServer.getMBeanInfo(new ObjectName(objectName))); } catch (MalformedObjectNameException | InstanceNotFoundException | IntrospectionException | ReflectionException e) { log.error("Error when retrieving mBean Inforation", e); } }
From source file:org.wso2.carbon.kernel.jmx.MBeanRegistratorTest.java
@Test(dependsOnMethods = { "testMBeanNotCompliant" }) public void testUnregisterAllMBeans() { MBeanServer mBeanServer = MBeanManagementFactory.getMBeanServer(); MBeanRegistrator.unregisterAllMBeans(); Assert.assertTrue(mBeanServer.getMBeanCount() == initialMBeanCount); }