CentrifugeImpl implements Centrifuge { @Override public void registerMbean() { try { final String mbeanName = getMbeanName(); logger.info(LOGGER_PREFIX + "registering mbean: {}", mbeanName); ManagementFactory.getPlatformMBeanServer().registerMBean( new CentrifugeController(this), new ObjectName(mbeanName) ); } catch (Throwable e) { logger.warn(LOGGER_PREFIX + "failed to register centrifuge mbean"); } } @SuppressWarnings("unused")  CentrifugeImpl();  CentrifugeImpl(final CentrifugeConfig config); @Override synchronized void start(); @Override synchronized void stop(); @Override boolean isWarm(); @Override void registerMbean(); @Override List<WarmerContainer> getWarmers(); @Override void registerWarmer(final WarmerConfig warmerConfig);  }
@Test public void testRegisterMbean() throws Exception { final CentrifugeImpl centrifuge = new CentrifugeImpl(new CentrifugeConfig()); final String mbeanName = centrifuge.getMbeanName(); try { ManagementFactory.getPlatformMBeanServer().getMBeanInfo(new ObjectName(mbeanName)); fail(); } catch (InstanceNotFoundException ignored) {} centrifuge.registerMbean(); assertNotNull(ManagementFactory.getPlatformMBeanServer().getMBeanInfo(new ObjectName(mbeanName))); }