use of javax.management.DynamicMBean in project ignite by apache.
the class IgniteUtils method registerMBean.
/**
* Registers MBean with the server.
*
* @param <T> Type of mbean.
* @param mbeanSrv MBean server.
* @param igniteInstanceName Ignite instance name.
* @param grp Name of the group.
* @param name Name of mbean.
* @param impl MBean implementation.
* @param itf MBean interface.
* @return JMX object name.
* @throws JMException If MBean creation failed.
*/
public static <T> ObjectName registerMBean(MBeanServer mbeanSrv, @Nullable String igniteInstanceName, @Nullable String grp, String name, T impl, @Nullable Class<T> itf) throws JMException {
assert mbeanSrv != null;
assert name != null;
assert itf != null;
DynamicMBean mbean = new IgniteStandardMXBean(impl, itf);
mbean.getMBeanInfo();
return mbeanSrv.registerMBean(mbean, makeMBeanName(igniteInstanceName, grp, name)).getObjectName();
}
use of javax.management.DynamicMBean in project ignite by apache.
the class IgniteUtils method registerCacheMBean.
/**
* Registers MBean with the server.
*
* @param <T> Type of mbean.
* @param mbeanSrv MBean server.
* @param igniteInstanceName Ignite instance name.
* @param cacheName Name of the cache.
* @param name Name of mbean.
* @param impl MBean implementation.
* @param itf MBean interface.
* @return JMX object name.
* @throws JMException If MBean creation failed.
*/
public static <T> ObjectName registerCacheMBean(MBeanServer mbeanSrv, @Nullable String igniteInstanceName, @Nullable String cacheName, String name, T impl, Class<T> itf) throws JMException {
assert mbeanSrv != null;
assert name != null;
assert itf != null;
DynamicMBean mbean = new IgniteStandardMXBean(impl, itf);
mbean.getMBeanInfo();
return mbeanSrv.registerMBean(mbean, makeCacheMBeanName(igniteInstanceName, cacheName, name)).getObjectName();
}
use of javax.management.DynamicMBean in project sling by apache.
the class JmxAdjustableStatusForTestingIT method invokeMBean.
private void invokeMBean(String operation, Object[] args, String[] signature) throws Exception {
ServiceReference[] serviceReference = bundleContext.getServiceReferences(DynamicMBean.class.getName(), "(jmx.objectname=org.apache.sling.healthcheck:type=AdjustableHealthCheckForTesting)");
DynamicMBean mBean = (DynamicMBean) bundleContext.getService(serviceReference[0]);
mBean.invoke(operation, args, signature);
}
use of javax.management.DynamicMBean in project spring-framework by spring-projects.
the class JmxUtilsTests method testIsMBeanWithDynamicMBean.
@Test
public void testIsMBeanWithDynamicMBean() throws Exception {
DynamicMBean mbean = new TestDynamicMBean();
assertTrue("Dynamic MBean not detected correctly", JmxUtils.isMBean(mbean.getClass()));
}
use of javax.management.DynamicMBean in project felix by apache.
the class InvokerMBeanServerInterceptor method getAttributes.
public AttributeList getAttributes(MBeanMetaData metadata, String[] attributes) {
if (metadata.dynamic) {
try {
return ((DynamicMBean) metadata.mbean).getAttributes(attributes);
} catch (JMRuntimeException x) {
throw x;
} catch (RuntimeException x) {
throw new RuntimeMBeanException(x);
} catch (Error x) {
throw new RuntimeErrorException(x);
}
} else {
AttributeList list = new AttributeList();
for (int i = 0; i < attributes.length; ++i) {
String name = attributes[i];
try {
Object value = getAttribute(metadata, name);
Attribute attr = new Attribute(name, value);
list.add(attr);
} catch (Exception ignored) {
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG))
logger.debug("Exception caught from getAttributes(), ignoring attribute " + name);
}
}
return list;
}
}
Aggregations