This package contains the core RJMX services.
The following example will print the help for all diagnostic commands:
IConnectionDescriptor descriptor = new ConnectionDescriptorBuilder().hostName("localhost").port(0).build(); ServerHandle handle = new ServerHandle(descriptor); try { IConnectionHandle connection = handle.connect("Run Diagnostic commands"); //$NON-NLS-1$ IDiagnosticCommandService dcmd = connection.getServiceOrDummy(IDiagnosticCommandService.class); for (IOperation operation : dcmd.getOperations()) { System.out.println(dcmd.runCtrlBreakHandlerWithResult(String.format("help %s", operation.getName()))); } } finally { handle.dispose(true); }
Services are normally added through the com.jrockit.mc.rjmx.service extension point. The extension point requires a factory which will be used to create your service. The factory must implement the com.jrockit.mc.rjmx.services.IServiceFactory interface. The following example shows how the flight recorder service is added in the plugin.xml for the RJMX plug-in itself:
Note that any plug-in can publish services in this manner.