Server.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:cacheonix-core 作者:
public static void main(String[] args) throws Exception
{
   // The address of the connector server
   JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx");

   // No need of environment variables or the MBeanServer at this point
   JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, null);
   ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol());

   MBeanServer server = MBeanServerFactory.createMBeanServer("remote.notification.example");
   // Register the connector server as MBean
   server.registerMBean(cntorServer, cntorServerName);

   // The rmiregistry needed to bind the RMI stub
   NamingService naming = new NamingService();
   ObjectName namingName = ObjectName.getInstance(":service=" + NamingService.class.getName());
   server.registerMBean(naming, namingName);
   naming.start();

   // Start the connector server
   cntorServer.start();

   System.out.println("Server up and running");
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号