List of usage examples for java.lang.management ManagementFactory getPlatformMBeanServer
public static synchronized MBeanServer getPlatformMBeanServer()
From source file:com.alibaba.dragoon.patrol.spring.MBeanServerFactoryBean.java
public MBeanServer getObject() throws Exception { return ManagementFactory.getPlatformMBeanServer(); }
From source file:com.alibaba.dragoon.patrol.spring.MBeanServerFactoryBean.java
public Class<?> getObjectType() { return ManagementFactory.getPlatformMBeanServer().getClass(); }
From source file:hivemall.mix.metrics.MetricsRegistry.java
public static void registerMBeans(@Nonnull MixServerMetrics metrics, int port) { final StandardMBean mbean; try {//from w ww . j ava 2 s . co m mbean = new StandardMBean(metrics, MixServerMetricsMBean.class); } catch (NotCompliantMBeanException e) { logger.error("Unexpected as GridNodeMetricsMBean: " + metrics.getClass().getName(), e); return; } final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); final ObjectName name = makeMBeanName("hivemall", MixServerMetricsMBean.class.getSimpleName(), "port=" + port); try { server.registerMBean(mbean, name); logger.info("Registered MBean: " + name); } catch (Exception e) { logger.error("Failed registering mbean: " + name, e); } }
From source file:org.rhq.enterprise.server.util.JMXUtil.java
public static MBeanServer getPlatformMBeanServer() { return ManagementFactory.getPlatformMBeanServer(); }
From source file:org.apache.camel.TestSupportJmxCleanup.java
public static void traceMBeans(String domain) throws Exception { MBeanServer mbsc = ManagementFactory.getPlatformMBeanServer(); String d = getDomainName(domain); Set<ObjectName> s = mbsc.queryNames(new ObjectName(d + ":*"), null); if (s.size() > 0) { LOG.warn(" + " + s.size() + " ObjectNames registered in domain \"" + d + "\""); for (ObjectName on : s) { LOG.warn(" | " + on); }/*from w w w .j a v a 2 s . com*/ } }
From source file:com.espertech.esper.metrics.jmx.CommonJMXUtil.java
public static void registerMBeanNonModel(ObjectName objectName, Object internal) { try {/*from www .j ava2 s. com*/ ManagementFactory.getPlatformMBeanServer().registerMBean(internal, objectName); } catch (Exception e) { log.error("Error registering mbean: " + e.getMessage(), e); } }
From source file:com.zavakid.mushroom.util.MBeans.java
/** * Register the MBean using our standard MBeanName format "hadoop:service=<serviceName>,name=<nameName>" Where the * <serviceName> and <nameName> are the supplied parameters * //from ww w . j av a 2s .c o m * @param serviceName * @param nameName * @param theMbean - the MBean to register * @return the named used to register the MBean */ static public ObjectName register(String serviceName, String nameName, Object theMbean) { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = getMBeanName(serviceName, nameName); try { mbs.registerMBean(theMbean, name); return name; } catch (InstanceAlreadyExistsException ie) { LOG.warn(name, ie); } catch (Exception e) { LOG.warn("Error registering " + name, e); } return null; }
From source file:org.rhq.plugins.jbossas.util.JBossMBeanUtility.java
public static MBeanServer getJBossMBeanServer() { List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); MBeanServer jbossServer = null; for (MBeanServer server : servers) { if ("jboss".equals(server.getDefaultDomain())) { jbossServer = server;/*from ww w. jav a 2s.co m*/ } } if (jbossServer == null) { jbossServer = ManagementFactory.getPlatformMBeanServer(); } return jbossServer; }
From source file:com.alibaba.dragoon.common.daemon.filter.JmxRegisterFilter.java
public JmxRegisterFilter(MBeanServer mbeanServer, ObjectName serviceObjectName) { if (mbeanServer == null) { this.mbeanServer = ManagementFactory.getPlatformMBeanServer(); } else {/*from w w w . j a v a2s .c o m*/ this.mbeanServer = mbeanServer; } this.serviceObjectName = serviceObjectName; }
From source file:org.apache.jxtadoop.metrics.util.MBeanUtil.java
/** * Register the MBean using our standard MBeanName format * "hadoop:service=<serviceName>,name=<nameName>" * Where the <serviceName> and <nameName> are the supplied parameters * //from w w w.j a v a2s .c om * @param serviceName * @param nameName * @param theMbean - the MBean to register * @return the named used to register the MBean */ static public ObjectName registerMBean(final String serviceName, final String nameName, final Object theMbean) { final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = getMBeanName(serviceName, nameName); try { mbs.registerMBean(theMbean, name); return name; } catch (InstanceAlreadyExistsException ie) { // Ignore if instance already exists } catch (Exception e) { e.printStackTrace(); } return null; }