use of javax.management.NotCompliantMBeanException in project hadoop by apache.
the class FSNamesystem method registerMBean.
/**
* Register the FSNamesystem MBean using the name
* "hadoop:service=NameNode,name=FSNamesystemState"
*/
private void registerMBean() {
// We can only implement one MXBean interface, so we keep the old one.
try {
StandardMBean bean = new StandardMBean(this, FSNamesystemMBean.class);
mbeanName = MBeans.register("NameNode", "FSNamesystemState", bean);
} catch (NotCompliantMBeanException e) {
throw new RuntimeException("Bad MBean setup", e);
}
LOG.info("Registered FSNamesystemState MBean");
}
use of javax.management.NotCompliantMBeanException in project hadoop by apache.
the class SimulatedFSDataset method registerMBean.
/**
* Register the FSDataset MBean using the name
* "hadoop:service=DataNode,name=FSDatasetState-<storageid>"
* We use storage id for MBean name since a minicluster within a single
* Java VM may have multiple Simulated Datanodes.
*/
void registerMBean(final String storageId) {
// We wrap to bypass standard mbean naming convetion.
// This wraping can be removed in java 6 as it is more flexible in
// package naming for mbeans and their impl.
StandardMBean bean;
try {
bean = new StandardMBean(this, FSDatasetMBean.class);
mbeanName = MBeans.register("DataNode", "FSDatasetState-" + storageId, bean);
} catch (NotCompliantMBeanException e) {
DataNode.LOG.warn("Error registering FSDatasetState MBean", e);
}
DataNode.LOG.info("Registered FSDatasetState MBean");
}
use of javax.management.NotCompliantMBeanException in project archaius by Netflix.
the class ConfigJMXManager method registerConfigMbean.
public static ConfigMBean registerConfigMbean(AbstractConfiguration config) {
StandardMBean mbean = null;
ConfigMBean bean = null;
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
bean = new BaseConfigMBean(config);
mbean = new StandardMBean(bean, ConfigMBean.class);
mbs.registerMBean(mbean, getJMXObjectName(config, bean));
} catch (NotCompliantMBeanException e) {
throw new RuntimeException("NotCompliantMBeanException", e);
} catch (InstanceAlreadyExistsException e) {
throw new RuntimeException("InstanceAlreadyExistsException", e);
} catch (MBeanRegistrationException e) {
throw new RuntimeException("MBeanRegistrationException", e);
} catch (Exception e) {
throw new RuntimeException("registerConfigMbeanException", e);
}
return bean;
}
use of javax.management.NotCompliantMBeanException in project redisson by redisson.
the class JCacheManager method enableStatistics.
@Override
public void enableStatistics(String cacheName, boolean enabled) {
checkNotClosed();
if (cacheName == null) {
throw new NullPointerException();
}
JCache<?, ?> cache = caches.get(cacheName);
if (cache == null) {
throw new NullPointerException();
}
if (enabled) {
JCacheStatisticsMXBean statBean = statBeans.get(cache);
if (statBean == null) {
statBean = new JCacheStatisticsMXBean();
JCacheStatisticsMXBean oldBean = statBeans.putIfAbsent(cache, statBean);
if (oldBean != null) {
statBean = oldBean;
}
}
try {
ObjectName objectName = queryNames("Statistics", cache);
if (!mBeanServer.isRegistered(objectName)) {
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 {
unregisterStatisticsBean(cache);
}
cache.getConfiguration(JCacheConfiguration.class).setStatisticsEnabled(enabled);
}
use of javax.management.NotCompliantMBeanException in project quasar by puniverse.
the class JMXFibersMonitor method registerMBean.
@SuppressWarnings({ "CallToPrintStackTrace", "CallToThreadDumpStack" })
protected void registerMBean() {
try {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
final ObjectName mxbeanName = new ObjectName(mbeanName);
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);
}
MonitoringServices.getInstance().addPerfNotificationListener(this, mbeanName);
}
Aggregations