Package javax.management.loading

Examples of javax.management.loading.MLet


   public void testMultipleRemoteMBeanServers() throws Exception
   {
      // The 1st remote server
      MBeanServer remoteServer1 = newMBeanServer();
      MLet mlet = new MLet(new URL[]{new URL("http", "host", 80, "/path")});
      ObjectName remoteMLetName = ObjectName.getInstance(":type=mlet");
      remoteServer1.registerMBean(mlet, remoteMLetName);
      JMXServiceURL address1 = new JMXServiceURL("rmi", "localhost", 0);
      JMXConnectorServer connectorServer1 = JMXConnectorServerFactory.newJMXConnectorServer(address1, null, null);
      ObjectName connectorServerName1 = ObjectName.getInstance(":type=connector,protocol=" + address1.getProtocol());
      remoteServer1.registerMBean(connectorServer1, connectorServerName1);
      connectorServer1.start();
      address1 = connectorServer1.getAddress();

      // The 2nd remote server
      MBeanServer remoteServer2 = newMBeanServer();
      Timer timer = new Timer();
      ObjectName remoteTimerName = ObjectName.getInstance(":type=timer");
      remoteServer2.registerMBean(timer, remoteTimerName);
      timer.start();
      JMXServiceURL address2 = new JMXServiceURL("rmi", "localhost", 0);
      JMXConnectorServer connectorServer2 = JMXConnectorServerFactory.newJMXConnectorServer(address2, null, remoteServer2);
      connectorServer2.start();
      address2 = connectorServer2.getAddress();

      // The local server
      MBeanServer localServer = newMBeanServer();
      RemoteMBeanProxy proxy1 = new RemoteMBeanProxy(remoteMLetName, address1, null, null);
      JMXConnector cntor = JMXConnectorFactory.connect(address2);
      RemoteMBeanProxy proxy2 = new RemoteMBeanProxy(remoteTimerName, cntor.getMBeanServerConnection());
      ObjectName proxyName1 = ObjectName.getInstance(":proxy=" + ObjectName.quote(remoteMLetName.getCanonicalName()));
      ObjectName proxyName2 = ObjectName.getInstance(":proxy=" + ObjectName.quote(remoteTimerName.getCanonicalName()));
      localServer.registerMBean(proxy1, proxyName1);
      localServer.registerMBean(proxy2, proxyName2);
      JMXServiceURL address3 = new JMXServiceURL("local", "localhost", 0);
      JMXConnectorServer connectorServer3 = JMXConnectorServerFactory.newJMXConnectorServer(address3, null, localServer);
      connectorServer3.start();
      address3 = connectorServer3.getAddress();

      // The client
      JMXConnector connector = JMXConnectorFactory.connect(address3);
      MBeanServerConnection mbsc = connector.getMBeanServerConnection();

      // Tests
      URL[] urls = (URL[])mbsc.getAttribute(proxyName1, "URLs");
      if (!Utils.arrayEquals(urls, mlet.getURLs())) fail();

      if (!timer.isActive()) fail();
      mbsc.invoke(proxyName2, "stop", null, null);
      if (timer.isActive()) fail();
   }
View Full Code Here


                server=MBeanServerFactory.createMBeanServer();

                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler-ant",
                        "loader", "ant");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);

                if( log.isDebugEnabled())
                    log.debug("Creating mbean server and loader "+ mlet +
                            " " + this.getClass().getClassLoader());
View Full Code Here

                server=MBeanServerFactory.createMBeanServer();

                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler-ant",
                        "loader", "ant");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);

                if( log.isDebugEnabled())
                    log.debug("Creating mbean server and loader "+ mlet +
                            " " + this.getClass().getClassLoader());
View Full Code Here

            // XXX Not very clean...  Just a workaround
            if( ! loaderLoaded ) {
                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler",
                        "loader", "modeler");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);
                loaderLoaded=true;
            }
       
            // Process nodes
View Full Code Here

            // XXX Not very clean...  Just a workaround
            if( ! loaderLoaded ) {
                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler",
                        "loader", "modeler");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);
                loaderLoaded=true;
            }
       
            // Process nodes
View Full Code Here

            // XXX Not very clean...  Just a workaround
            if( ! loaderLoaded ) {
                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler",
                        "loader", "modeler");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);
                loaderLoaded=true;
            }
       
            // Process nodes
View Full Code Here

            // XXX Not very clean...  Just a workaround
            if( ! loaderLoaded ) {
                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler",
                        "loader", "modeler");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);
                loaderLoaded=true;
            }
       
            // Process nodes
View Full Code Here

            ex.initCause(e);
            throw ex;
        }


        MLet bootMLet = new MLet();
        try {
            server.registerMBean(bootMLet, objectName);
        } catch (Exception e) {
            // it should be impossible for this registration to fail
            IllegalStateException ex = new IllegalStateException(e.getMessage());
            ex.initCause(e);
            throw ex;
        }
        return bootMLet.getMBeansFromURL(mletURL);
    }
View Full Code Here

            // XXX Not very clean...  Just a workaround
            if( ! loaderLoaded ) {
                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler",
                        "loader", "modeler");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);
                loaderLoaded=true;
            }
       
            // Process nodes
View Full Code Here

            // XXX Not very clean...  Just a workaround
            if( ! loaderLoaded ) {
                // Register a loader that will be find ant classes.
                ObjectName defaultLoader= new ObjectName("modeler",
                        "loader", "modeler");
                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
                server.registerMBean(mlet, defaultLoader);
                loaderLoaded=true;
            }
       
            // Process nodes
View Full Code Here

TOP

Related Classes of javax.management.loading.MLet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.