List of usage examples for javax.management ObjectName getInstance
public static ObjectName getInstance(String domain, String key, String value) throws MalformedObjectNameException
Return an instance of ObjectName that can be used anywhere an object obtained with #ObjectName(String,String,String) new ObjectName(domain, key, value) can be used.
From source file:co.runrightfast.core.utils.JmxUtils.java
/** * * @param domain JMX domain/*from w w w.java 2s . c o m*/ * @param mbeanType used to add a type attribute * @return ObjectName */ static ObjectName applicationMBeanObjectName(final String domain, @NonNull final Class<?> mbeanType) { checkArgument(isNotBlank(domain)); try { return ObjectName.getInstance(domain, "type", mbeanType.getSimpleName()); } catch (final MalformedObjectNameException e) { throw new RuntimeException(e); } }
From source file:my.school.spring.beans.ProfilingBeanPostProcessor.java
public ProfilingBeanPostProcessor() { try {/*from w w w .ja va 2 s . c o m*/ ManagementFactory.getPlatformMBeanServer().registerMBean(profilingController, ObjectName.getInstance("my.school", "profiling", "profiling")); } catch (MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException ex) { LOG.error(ex.getMessage()); } }
From source file:org.sonatype.nexus.internal.httpclient.PoolingClientConnectionManagerMBeanInstaller.java
/** * Registers the connection manager to JMX. *//*from w w w . j a v a2 s . c o m*/ synchronized void register(final PoolingHttpClientConnectionManager connectionManager) { if (jmxName == null) { try { jmxName = ObjectName.getInstance(JMX_DOMAIN, "name", PoolingHttpClientConnectionManager.class.getSimpleName()); final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); server.registerMBean(new PoolingClientConnectionManagerMBeanImpl(connectionManager), jmxName); } catch (final Exception e) { LOGGER.warn("Failed to register mbean {} due to {}:{}", jmxName, e.getClass(), e.getMessage()); jmxName = null; } } else { LOGGER.warn("Already registered mbean {}", jmxName); } }
From source file:org.sonatype.nexus.apachehttpclient.PoolingClientConnectionManagerMBeanInstaller.java
/** * Registers the connection manager to JMX. *///from www .j a v a 2s. c o m public synchronized void register(final PoolingHttpClientConnectionManager connectionManager) { if (jmxName == null) { try { jmxName = ObjectName.getInstance(JMX_DOMAIN, "name", PoolingHttpClientConnectionManager.class.getSimpleName()); final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); server.registerMBean(new PoolingClientConnectionManagerMBeanImpl(connectionManager), jmxName); } catch (final Exception e) { LOGGER.warn("Failed to register mbean {} due to {}:{}", jmxName, e.getClass(), e.getMessage()); jmxName = null; } } else { LOGGER.warn("Already registered mbean {}", jmxName); } }