1 8 9 package org.webjmx.remoting; 10 11 import java.io.*; 12 import java.net.*; 13 14 import javax.management.*; 15 16 import com.sun.jdmk.*; 18 import com.sun.jdmk.comm.*; 19 20 21 public class RemotingServer 22 { 23 private MBeanServer server; 24 25 public RemotingServer() 26 { 27 try { Trace.parseTraceProperties(); } 28 catch(IOException e) { e.printStackTrace(); } 29 30 server = MBeanServerFactory.createMBeanServer(); 31 32 CommunicatorServer htmlAdaptor = new HtmlAdaptorServer(); 33 34 try 35 { 36 ObjectName htmlAdaptorObjectName = null; 37 ObjectInstance htmlAdaptorInstance = server.registerMBean(htmlAdaptor, htmlAdaptorObjectName); 38 htmlAdaptor.start(); 39 40 CommunicatorServer rmiConnector = new RmiConnectorServer(); 41 42 ObjectName rmiConnectorName = null; 43 ObjectInstance rmiConnectorInstance = server.registerMBean(rmiConnector, rmiConnectorName); 44 45 rmiConnector.start(); 46 System.out.println("started RemoteMBean server listening on port: " +rmiConnector.getPort()); 47 }catch(Exception e) 48 { 49 e.printStackTrace(); 50 } 51 } 52 53 54 public static void main(String [] args) 55 { 56 RemotingServer myBaseAgent = new RemotingServer(); 57 } 58 } 59 | Popular Tags |