use of javax.management.MalformedObjectNameException in project archaius by Netflix.
the class ConfigJMXManager method getJMXObjectName.
private static ObjectName getJMXObjectName(AbstractConfiguration config, ConfigMBean bean) throws Exception {
try {
Class<? extends ConfigMBean> c = bean.getClass();
String className = c.getName();
int lastDot = className.lastIndexOf('.');
ObjectName name = new ObjectName("Config-" + className.substring(0, lastDot) + ":class=" + className.substring(lastDot + 1));
return name;
} catch (MalformedObjectNameException e) {
throw new RuntimeException("MalformedObjectNameException", e);
} catch (NullPointerException e) {
throw new RuntimeException("NullPointerException", e);
}
}
use of javax.management.MalformedObjectNameException 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.MalformedObjectNameException 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.MalformedObjectNameException 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.MalformedObjectNameException 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);
}
Aggregations