List of usage examples for javax.management ObjectName ObjectName
public ObjectName(String name) throws MalformedObjectNameException
From source file:org.red5.server.ClientRegistry.java
public ClientRegistry(String name) { this.name = name; if (StringUtils.isNotBlank(this.name)) { try {// w w w. j a v a 2 s. co m MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName oName = new ObjectName("org.red5.server:type=ClientRegistry,name=" + name); mbeanServer.registerMBean(new StandardMBean(this, ClientRegistryMXBean.class, true), oName); } catch (Exception e) { //log.warn("Error on jmx registration", e); } } }
From source file:org.fishwife.jrugged.spring.TestPerformanceMonitorBeanFactory.java
@Test public void testCreatePerformanceMonitorObjectName() throws MalformedObjectNameException, NullPointerException { mockMBeanExporter = createMock(MBeanExporter.class); ObjectName objectName = new ObjectName( "org.fishwife.jrugged.spring:type=" + "PerformanceMonitorBean,name=testCreate"); mockMBeanExporter.registerManagedResource(EasyMock.<Object>anyObject(), EasyMock.eq(objectName)); replay(mockMBeanExporter);/* www . jav a 2 s.com*/ factory.setMBeanExportOperations(mockMBeanExporter); factory.createPerformanceMonitor("testCreate"); EasyMock.verify(mockMBeanExporter); }
From source file:de.iew.spring.integration.SpringIntegrationJmxTest.java
@Test public void testJmxClientClassic() throws Exception { JMXServiceURL clientURL = new JMXServiceURL(this.serviceUrl); Map clientEnv = new HashMap(); JMXConnector connector = JMXConnectorFactory.connect(clientURL, clientEnv); MBeanServerConnection connection = connector.getMBeanServerConnection(); ObjectName mbeanName = new ObjectName(this.jmxTestServiceObjectName); JmxTestService mbeanProxy = JMX.newMBeanProxy(connection, mbeanName, JmxTestService.class, true); mbeanProxy.setName("Foo Bar"); mbeanProxy.sayHello();//from w w w . j a v a 2s. com String[] hellos = mbeanProxy.getStoredHellos(); Assert.assertEquals(1, hellos.length); mbeanProxy.clearHelloStore(); hellos = mbeanProxy.getStoredHellos(); Assert.assertEquals(0, hellos.length); }
From source file:com.bigdata.dastor.service.StorageProxy.java
public static void init() // BIGDATA: use init() { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try {/*from ww w. ja v a 2s . co m*/ mbs.registerMBean(new StorageProxy(), new ObjectName(MBEAN_OBJECT_NAME)); // BIGDATA } catch (Exception e) { throw new RuntimeException(e); } }
From source file:net.lightbody.bmp.proxy.jetty.jetty.servlet.jmx.HolderMBean.java
public synchronized ObjectName uniqueObjectName(MBeanServer server, String objectName) { try {/*from w w w . ja v a 2s .c om*/ String name = _holder.getDisplayName(); if (name == null || name.length() == 0) name = _holder.getClassName(); return new ObjectName(objectName + ",name=" + name); } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); return super.uniqueObjectName(server, objectName); } }
From source file:com.flexive.shared.mbeans.FxCacheProxy.java
public FxCacheProxy(MBeanServer server) throws MalformedObjectNameException { this.server = server; this.name = new ObjectName(CacheAdmin.CACHE_SERVICE_NAME); }
From source file:com.bigdata.dastor.gms.FailureDetector.java
public FailureDetector() { phiConvictThreshold_ = DatabaseDescriptor.getPhiConvictThreshold(); creationTime_ = System.currentTimeMillis(); // Register this instance with JMX try {/* www . j a va 2 s . c om*/ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(this, new ObjectName("com.bigdata.dastor.gms:type=FailureDetector")); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:fr.juanwolf.mysqlbinlogreplicator.service.MysqlBinLogService.java
@PostConstruct public void postConstruct() throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException { log.debug("Create BinaryLogClient {}@{}:{}", mysqlUser, mysqlHost, mysqlPort); client = new BinaryLogClient(mysqlHost, mysqlPort, mysqlUser, mysqlPassword); log.debug("Getting columns names."); getColumnName();/* w ww. ja v a2 s . co m*/ log.debug("Activate JMXBean"); ObjectName objectName = new ObjectName("mysql.binlog:type=BinaryLogClient"); mBeanServer.registerMBean(client, objectName); BinaryLogClientStatistics stats = new BinaryLogClientStatistics(client); ObjectName statsObjectName = new ObjectName("mysql.binlog:type=BinaryLogClientStatistics"); mBeanServer.registerMBean(stats, statsObjectName); }
From source file:co.paralleluniverse.common.monitoring.Monitor.java
public void unregisterMBean() { try {//from w ww . j a va2s . c om if (registered) { LOG.info("Unregistering MBean {}", name); ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name)); } this.registered = false; } catch (Exception e) { LOG.warn("Exception:", e); } }
From source file:io.fabric8.mq.controller.coordination.BrokerJMXPropertiesTest.java
public String getBrokerName() throws Exception { String type = "org.apache.activemq:type=Broker,*"; String attribute = "BrokerName"; ObjectName objectName = new ObjectName(type); J4pResponse<J4pReadRequest> result = client.execute(new J4pReadRequest(objectName, attribute)); JSONObject jsonObject = result.getValue(); Assert.assertNotNull(jsonObject);/*from w w w.j av a 2 s . co m*/ Object key = jsonObject.keySet().iterator().next(); JSONObject value = (JSONObject) jsonObject.get(key); String name = value.values().iterator().next().toString(); System.err.println("BROKER NAME = " + name); Assert.assertNotNull(value); Assert.assertEquals(BROKER_NAME, name); return name; }