private void unregisterRecordProcessor(final RecordProcessor processor, final Endpoint ep) { MBeanServer mbeanServer = mBeanServerValue.getValue(); if (mbeanServer != null) { try { mbeanServer.unregisterMBean( ObjectNameFactory.create(ep.getName() + ",recordProcessor=" + processor.getName())); } catch (final JMException e) { ROOT_LOGGER.cannotUnregisterRecordProcessor(); } } else { ROOT_LOGGER.mBeanServerNotAvailable(processor); } }
private void registerRecordProcessor(final RecordProcessor processor, final Endpoint ep) { MBeanServer mbeanServer = mBeanServerValue.getValue(); if (mbeanServer != null) { try { mbeanServer.registerMBean( processor, ObjectNameFactory.create(ep.getName() + ",recordProcessor=" + processor.getName())); } catch (final JMException ex) { ROOT_LOGGER.trace( "Cannot register endpoint with JMX server, trying with the default ManagedRecordProcessor: " + ex.getMessage()); try { mbeanServer.registerMBean( new ManagedRecordProcessor(processor), ObjectNameFactory.create(ep.getName() + ",recordProcessor=" + processor.getName())); } catch (final JMException e) { ROOT_LOGGER.cannotRegisterRecordProcessor(); } } } else { ROOT_LOGGER.mBeanServerNotAvailable(processor); } }