final int min = builder.getMin();
long maxAge = builder.getMaxAge().getTime(TimeUnit.MILLISECONDS);
double maxAgeOffset = builder.getMaxAgeOffset();
final ObjectNameBuilder jmxName = new ObjectNameBuilder("openejb.management");
jmxName.set("J2EEServer", "openejb");
jmxName.set("J2EEApplication", null);
jmxName.set("EJBModule", beanContext.getModuleID());
jmxName.set("StatelessSessionBean", beanContext.getEjbName());
jmxName.set("j2eeType", "");
jmxName.set("name", beanContext.getEjbName());
final MBeanServer server = LocalMBeanServer.get();
// Create stats interceptor
if (StatsInterceptor.isStatsActivated()) {
StatsInterceptor stats = new StatsInterceptor(beanContext.getBeanClass());
beanContext.addSystemInterceptor(stats);
// register the invocation stats interceptor
try {
ObjectName objectName = jmxName.set("j2eeType", "Invocations").build();
server.registerMBean(new ManagedMBean(stats), objectName);
data.add(objectName);
} catch (Exception e) {
logger.error("Unable to register MBean ", e);
}
}
// register the pool
try {
ObjectName objectName = jmxName.set("j2eeType", "Pool").build();
server.registerMBean(new ManagedMBean(data.pool), objectName);
data.add(objectName);
} catch (Exception e) {
logger.error("Unable to register MBean ", e);
}