use of javax.management.MBeanServer in project neo4j by neo4j.
the class JmxService method listDomains.
@GET
@Path(DOMAINS_PATH)
public Response listDomains() throws NullPointerException {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ListRepresentation domains = ListRepresentation.strings(server.getDomains());
return output.ok(domains);
}
use of javax.management.MBeanServer in project tdi-studio-se by Talend.
the class Agent method registerMXBeans.
/**
* Registers the MXBeans.
*
* @param inst
* The instrumentation
* @return <tt>true</tt> if registered, and <tt>false</tt> if nothing was
* done since MBeans had already been registered.
* @throws Throwable
*/
private static boolean registerMXBeans(Instrumentation inst) throws Throwable {
boolean agentLoaded = false;
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName profilerObjectName = new ObjectName(CpuBciProfilerMXBean.PROFILER_MXBEAN_NAME);
ObjectName dataTransferObjectName = new ObjectName(DataTransferMXBean.DATA_TRANSFER_MXBEAN_NAME);
ObjectName swtResourceMonitorObjectName = new ObjectName(SWTResourceMonitorMXBean.SWT_RESOURCE_MONITOR_MXBEAN_NAME);
if (!server.isRegistered(profilerObjectName)) {
CpuBciProfilerMXBeanImpl profiler = new CpuBciProfilerMXBeanImpl(inst);
server.registerMBean(profiler, profilerObjectName);
agentLoaded = true;
}
if (!server.isRegistered(dataTransferObjectName)) {
DataTransferMXBeanImpl dataTransfer = new DataTransferMXBeanImpl();
server.registerMBean(dataTransfer, dataTransferObjectName);
agentLoaded = true;
}
if (!server.isRegistered(swtResourceMonitorObjectName)) {
SWTResourceMonitorMXBeanImpl swtResourceMonitor = new SWTResourceMonitorMXBeanImpl(inst);
if (swtResourceMonitor.isSuppoted()) {
server.registerMBean(swtResourceMonitor, swtResourceMonitorObjectName);
}
agentLoaded = true;
}
return agentLoaded;
}
use of javax.management.MBeanServer in project voltdb by VoltDB.
the class ManagedUtil method registerLog4jMBeans.
/**
* Register the log4j JMX mbeans. Set environment variable
* "zookeeper.jmx.log4j.disable" to true to disable registration.
* @see http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/jmx/package-summary.html
* @throws JMException if registration fails
*/
public static void registerLog4jMBeans() throws JMException {
if (Boolean.getBoolean("zookeeper.jmx.log4j.disable") == true) {
return;
}
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
// Create and Register the top level Log4J MBean
HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
ObjectName mbo = new ObjectName("log4j:hiearchy=default");
mbs.registerMBean(hdm, mbo);
// Add the root logger to the Hierarchy MBean
Logger rootLogger = Logger.getRootLogger();
hdm.addLoggerMBean(rootLogger.getName());
// Get each logger from the Log4J Repository and add it to
// the Hierarchy MBean created above.
LoggerRepository r = LogManager.getLoggerRepository();
Enumeration enumer = r.getCurrentLoggers();
Logger logger = null;
while (enumer.hasMoreElements()) {
logger = (Logger) enumer.nextElement();
hdm.addLoggerMBean(logger.getName());
}
}
use of javax.management.MBeanServer in project nhin-d by DirectProject.
the class DNSServer method registerMBean.
/**
* Register the MBean
*/
private void registerMBean(DNSServerSettings settings) {
String[] itemNames = { "Port", "Bind Address", "Max Request Size", "Max Outstanding Accepts", "Max Active Accepts", "Max Connection Backlog", "Read Buffer Size", "Send Timeout", "Receive Timeout", "Socket Close Timeout" };
String[] itemDesc = { "Port", "Bind Address", "Max Request Size", "Max Outstanding Accepts", "Max Active Accepts", "Max Connection Backlog", "Read Buffer Size", "Send Timeout", "Receive Timeout", "Socket Close Timeout" };
OpenType<?>[] types = { SimpleType.INTEGER, SimpleType.STRING, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER };
Object[] settingsValues = { settings.getPort(), settings.getBindAddress(), settings.getMaxRequestSize(), settings.getMaxOutstandingAccepts(), settings.getMaxActiveRequests(), settings.getMaxConnectionBacklog(), settings.getReadBufferSize(), settings.getSendTimeout(), settings.getReceiveTimeout(), settings.getSocketCloseTimeout() };
try {
CompositeType settingsType = new CompositeType(DNSServerSettings.class.getSimpleName(), "DNS server settings.", itemNames, itemDesc, types);
settingsData = new CompositeDataSupport(settingsType, itemNames, settingsValues);
} catch (OpenDataException e) {
LOGGER.error("Failed to create settings composite type: " + e.getLocalizedMessage(), e);
return;
}
Class<?> clazz = this.getClass();
final StringBuilder objectNameBuilder = new StringBuilder(clazz.getPackage().getName());
objectNameBuilder.append(":type=").append(clazz.getSimpleName());
objectNameBuilder.append(",name=").append(UUID.randomUUID());
try {
final StandardMBean mbean = new StandardMBean(this, DNSServerMBean.class);
final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
mbeanServer.registerMBean(mbean, new ObjectName(objectNameBuilder.toString()));
} catch (JMException e) {
LOGGER.error("Unable to register the DNSServer MBean", e);
}
}
use of javax.management.MBeanServer in project nhin-d by DirectProject.
the class DNSSocketServer method registerMBean.
protected void registerMBean(Class<?> clazz) {
final StringBuilder objectNameBuilder = new StringBuilder(clazz.getPackage().getName());
objectNameBuilder.append(":type=").append(clazz.getSimpleName());
objectNameBuilder.append(",name=").append(UUID.randomUUID());
try {
final StandardMBean mbean = new StandardMBean(this, DNSSocketServerMBean.class);
final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
mbeanServer.registerMBean(mbean, new ObjectName(objectNameBuilder.toString()));
} catch (JMException e) {
LOGGER.error("Unable to register the DNSSocketServer MBean", e);
}
}
Aggregations