// connect to child process via MBeans
JMXServiceURL jmxURL = extractJmxServiceUrl(pid);
JMXConnector connector = JMXConnectorFactory.connect(jmxURL);
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
ObjectName mbeanName = new ObjectName("my.code.a003.process:type=PrintOnRemoteRequest.MessagePrinter");
MessagePrinterMBean printerProxy = JMX.newMBeanProxy(mbsc, mbeanName,
MessagePrinterMBean.class, true);
// call method on child process via MBean
printerProxy.printMessage("Hello world!");
// close connection to child application
connector.close();
} finally {
if (childProcess != null) {