use of javax.management.MBeanRegistrationException in project quasar by puniverse.
the class JMXActorMonitor method unregisterMBean.
public void unregisterMBean() {
try {
if (registered) {
ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name));
MonitoringServices.getInstance().removePerfNotificationListener(this);
}
this.registered = false;
} catch (InstanceNotFoundException | MBeanRegistrationException | MalformedObjectNameException ex) {
ex.printStackTrace();
}
}
use of javax.management.MBeanRegistrationException in project quasar by puniverse.
the class JMXFibersMonitor method unregister.
@SuppressWarnings({ "CallToPrintStackTrace", "CallToThreadDumpStack" })
@Override
public void unregister() {
try {
if (registered) {
MonitoringServices.getInstance().removePerfNotificationListener(this);
ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(mbeanName));
}
this.registered = false;
} catch (InstanceNotFoundException ex) {
ex.printStackTrace();
} catch (MBeanRegistrationException ex) {
ex.printStackTrace();
} catch (MalformedObjectNameException ex) {
throw new AssertionError(ex);
}
}
use of javax.management.MBeanRegistrationException in project quasar by puniverse.
the class SimpleMBean method registerMBean.
protected void registerMBean() {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName mxbeanName = new ObjectName(name);
mbs.registerMBean(this, mxbeanName);
this.registered = true;
} catch (InstanceAlreadyExistsException ex) {
throw new RuntimeException(ex);
} catch (MBeanRegistrationException ex) {
ex.printStackTrace();
} catch (NotCompliantMBeanException ex) {
throw new AssertionError(ex);
} catch (MalformedObjectNameException ex) {
throw new AssertionError(ex);
}
}
use of javax.management.MBeanRegistrationException in project redisson by redisson.
the class JCacheManager method enableManagement.
@Override
public void enableManagement(String cacheName, boolean enabled) {
checkNotClosed();
if (cacheName == null) {
throw new NullPointerException();
}
JCache<?, ?> cache = caches.get(cacheName);
if (cache == null) {
throw new NullPointerException();
}
if (enabled) {
JCacheManagementMXBean statBean = managementBeans.get(cache);
if (statBean == null) {
statBean = new JCacheManagementMXBean(cache);
JCacheManagementMXBean oldBean = managementBeans.putIfAbsent(cache, statBean);
if (oldBean != null) {
statBean = oldBean;
}
}
try {
ObjectName objectName = queryNames("Configuration", cache);
if (mBeanServer.queryNames(objectName, null).isEmpty()) {
mBeanServer.registerMBean(statBean, objectName);
}
} catch (MalformedObjectNameException e) {
throw new CacheException(e);
} catch (InstanceAlreadyExistsException e) {
throw new CacheException(e);
} catch (MBeanRegistrationException e) {
throw new CacheException(e);
} catch (NotCompliantMBeanException e) {
throw new CacheException(e);
}
} else {
unregisterManagementBean(cache);
}
cache.getConfiguration(JCacheConfiguration.class).setManagementEnabled(enabled);
}
use of javax.management.MBeanRegistrationException in project ACS by ACS-Community.
the class RemoteThreadsClient method getMBean.
/**
* Returns an object representing the MBean registered on the remote JVM agent. If the
* MBean has not been registered, then it is registered and then retreived.
* @return A {@link RemoteThreadsMBean} object representing the MBean registered
* on the remote JVM agent.
* @throws RemoteThreadsException If:
* <ul>
* <li>The MBean can't be registered on the remote JVM agent</li>
* <li>A local reference for this MBean can't be get</li>
* </ul>
*/
public RemoteThreadsMBean getMBean() throws RemoteThreadsException {
if (rtmb == null) {
try {
ObjectName remoteThreadsName = new ObjectName("alma.acs.monitoring:type=RemoteThreads");
if (!remote.isRegistered(remoteThreadsName))
remote.createMBean("alma.acs.monitoring.RemoteThreads", remoteThreadsName);
rtmb = JMX.newMBeanProxy(remote, remoteThreadsName, RemoteThreadsMBean.class);
} catch (MalformedObjectNameException e) {
// shouldn't get never get here
} catch (MBeanRegistrationException e) {
throw new RemoteThreadsException("Can't register the MBean in the remote server", e);
} catch (Exception e) {
throw new RemoteThreadsException("Can't get a reference to the remote MBean", e);
}
}
return rtmb;
}
Aggregations