use of javax.management.JMException in project Payara by payara.
the class BootAMX method create.
/**
* Create an instance of the booter.
*/
public static synchronized BootAMX create(final ServiceLocator habitat, final MBeanServer server) {
final BootAMX booter = new BootAMX(habitat, server);
final ObjectName objectName = getBootAMXMBeanObjectName();
try {
final StandardMBean mbean = new StandardMBean(booter, BootAMXMBean.class);
if (!server.registerMBean(mbean, objectName).getObjectName().equals(objectName)) {
throw new IllegalStateException();
}
} catch (JMException e) {
e.printStackTrace();
throw new IllegalStateException(e);
}
return booter;
}
use of javax.management.JMException in project wso2-synapse by wso2.
the class FIXSessionFactory method initJMX.
private void initJMX(Connector connector, String service) {
try {
JmxExporter jmxExporter = new JmxExporter();
jmxExporter.setRegistrationBehavior(JmxExporter.REGISTRATION_IGNORE_EXISTING);
jmxExporter.export(connector);
} catch (JMException e) {
log.error("Error while initializing JMX support for the service: " + service, e);
}
}
use of javax.management.JMException in project fabric8 by jboss-fuse.
the class MBeanRegistry method register.
/**
* Registers a new MBean with the platform MBean server.
* @param bean the bean being registered
* @param parent if not null, the new bean will be registered as a child
* node of this parent.
*/
public void register(ZKMBeanInfo bean, ZKMBeanInfo parent) throws JMException {
assert bean != null;
String path = null;
if (parent != null) {
path = mapBean2Path.get(parent);
assert path != null;
}
path = makeFullPath(path, parent);
mapBean2Path.put(bean, path);
mapName2Bean.put(bean.getName(), bean);
if (bean.isHidden())
return;
ObjectName oname = makeObjectName(path, bean);
try {
mBeanServer.registerMBean(bean, oname);
} catch (JMException e) {
LOG.warn("Failed to register MBean " + bean.getName());
throw e;
}
}
use of javax.management.JMException in project fabric8 by jboss-fuse.
the class EnableJMXFeature method initialize.
@Override
public void initialize(Bus bus) {
List<Server> servers = new ArrayList<Server>();
ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
servers.addAll(serverRegistry.getServers());
for (Iterator<Server> iter = servers.iterator(); iter.hasNext(); ) {
Server server = (Server) iter.next();
ManagedApi mApi = new ManagedApi(bus, server.getEndpoint(), server);
InstrumentationManager iMgr = bus.getExtension(InstrumentationManager.class);
if (iMgr == null) {
iMgr = new InstrumentationManagerImpl(bus);
}
((InstrumentationManagerImpl) iMgr).setUsePlatformMBeanServer(true);
((InstrumentationManagerImpl) iMgr).setCreateMBServerConnectorFactory(false);
((InstrumentationManagerImpl) iMgr).setEnabled(true);
((InstrumentationManagerImpl) iMgr).init();
if (iMgr != null) {
try {
iMgr.register(mApi);
} catch (JMException jmex) {
jmex.printStackTrace();
LOG.log(Level.WARNING, "Registering ManagedApi failed.", jmex);
}
}
}
}
use of javax.management.JMException in project fabric8 by jboss-fuse.
the class MXBeansProvider method activateInternal.
private void activateInternal() {
MBeanServer server = mbeanServer.get();
try {
ProfileManagement profileMXBean = new ProfileManagementImpl();
server.registerMBean(new StandardMBean(profileMXBean, ProfileManagement.class, true), new ObjectName(ProfileManagement.OBJECT_NAME));
} catch (JMException ex) {
throw new IllegalStateException(ex);
}
}
Aggregations