cons.setProfileLevel(ProfileLevel.MAX);
ObjectName name = new ObjectName(ChannelServiceMXBean.MXBEAN_NAME);
// Ensure the object was registered at startup
ChannelServiceMXBean bean = (ChannelServiceMXBean)
profileCollector.getRegisteredMBean(
ChannelServiceMXBean.MXBEAN_NAME);
assertNotNull(bean);
// Get individual fields
long create = (Long) mbsc.getAttribute(name, "CreateChannelCalls");
long get = (Long) mbsc.getAttribute(name, "GetChannelCalls");
// Create the proxy for the object
ChannelServiceMXBean proxy =
JMX.newMXBeanProxy(mbsc, name, ChannelServiceMXBean.class);
assertTrue(create <= proxy.getCreateChannelCalls());
assertTrue(get <= proxy.getGetChannelCalls());
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() {
try {
serverNode.getChannelService().getChannel("foo");
} catch (NameNotBoundException nnb) {
System.out.println("Got expected exception " + nnb);
}
}
}, taskOwner);
assertTrue(get < proxy.getGetChannelCalls());
assertTrue(get < bean.getGetChannelCalls());
}