Examples of JMXConnectorServer


Examples of javax.management.remote.JMXConnectorServer

            JMXServiceURL url = new JMXServiceURL(
              "service:jmx:rmi:///jndi/rmi://localhost:" + port + "/testApp");
            Map<String, Object> env = new HashMap<String, Object>();
            JMXAuthenticator authenticator = new MyJMXAuthenticator();
            env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
            JMXConnectorServer cs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url,
                 env, getMBeanServer());
            cs.start();
            logger.info("JMXConnectorServer started. URL: " + url.toString());
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Failure while starting RMI connector", e);
        }
    }
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

            JMXServiceURL url = new JMXServiceURL(
              "service:jmx:jmxmp://localhost:" + port);
            Map<String, Object> env = new HashMap<String, Object>();
            JMXAuthenticator authenticator = new MyJMXAuthenticator();
            env.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
            JMXConnectorServer cs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url,
                 env, getMBeanServer());
            cs.start();
            logger.info("JMXConnectorServer started. URL: " + url.toString());
        } catch (IOException e) {
            logger.log(Level.SEVERE, "Failure while starting RMI connector", e);
        }
    }
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

          };
          environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);
        }

        JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, _mbeanServer);
        cs.start();

      }
    }
    catch (Exception ex)
    {
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

        assertJmxEquals("availableNodeCount", 9);
        assertJmxEquals("nodeCount", 9);
    }

    protected void assertJmxEquals(String attributeName, Object attributeValue) throws Exception {
        JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(new JMXServiceURL("service:jmx:rmi://"),
                                                                                null,
                                                                                ManagementFactory.getPlatformMBeanServer());
        cs.start();

        JMXConnector cc = null;

        try {
            cc = JMXConnectorFactory.connect(cs.getAddress());
            MBeanServerConnection mbsc = cc.getMBeanServerConnection();
            ObjectName objectName = JmxUtils.createObjectName(JmxUtils.getPackageName(failureDetector.getClass()),
                                                              failureDetector.getClass()
                                                                             .getSimpleName());

            Object availableNodes = mbsc.getAttribute(objectName, attributeName);
            assertEquals(attributeValue, availableNodes);
        } finally {
            if(cc != null)
                cc.close();

            cs.stop();
        }
    }
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

        }
        public Socket createSocket(String host, int port) throws IOException {
          return new Socket(host, port);
        }
      });
      JMXConnectorServer jmxServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, env, server);
      server.registerMBean(jmxServer, JMXHelper.objectName("org.helios.netty:service=JMXConnectorServer,url=" + ObjectName.quote(serviceURL.toString())));
      jmxServer.start();
    } catch (Exception e) {
      throw new RuntimeException("Failed to start JMXServer on [" + serviceURL + "]", e);
    }
  }
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

              + server);
    } else {
      try {
        // Create a new MBeanServer with the given serviceUrl
        server = MBeanServerFactory.newMBeanServer();
        JMXConnectorServer connector = JMXConnectorServerFactory
                .newJMXConnectorServer(new JMXServiceURL(jmxConfig.serviceUrl),
                        null, server);
        connector.start();
        LOG.info("JMX monitoring is enabled at " + jmxConfig.serviceUrl);
      } catch (Exception e) {
        // Release the reference
        server = null;
        throw new RuntimeException("Could not start JMX monitoring ", e);
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

                    serverName, url.toString()), e);
            return null;
        }
       
        // Start the JMX server with the connection string
        JMXConnectorServer cs = null;
        try {
            cs = JMXConnectorServerFactory.newJMXConnectorServer(
                    serviceUrl, theEnv, theMBeanServer);
            cs.start();
            log.info(sm.getString("jmxRemoteLifecycleListener.start",
                    Integer.toString(theRmiRegistryPort),
                    Integer.toString(theRmiServerPort), serverName));
        } catch (IOException e) {
            log.error(sm.getString(
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

        try
        {
            // Convert the serviceUrl string to instance of JMXServiceURL
            JMXServiceURL address = new JMXServiceURL(parameter.getJmxServiceURL());

            JMXConnectorServer server = javax.management.remote.JMXConnectorServerFactory
                    .newJMXConnectorServer(address, env, null);

            return server;
        }
        catch (Exception e)
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

        try
        {
            // Convert the serviceUrl string to instance of JMXServiceURL
            JMXServiceURL address = new JMXServiceURL(parameter.getJmxServiceURL());

            JMXConnectorServer server = javax.management.remote.JMXConnectorServerFactory
                    .newJMXConnectorServer(address, env, null);

            return server;
        }
        catch (Exception e)
View Full Code Here

Examples of javax.management.remote.JMXConnectorServer

                } catch (Throwable ignore) {
                }
                Thread t = new Thread("JMX connector") {
                    public void run() {
                        try {
                            JMXConnectorServer server = connectorServer;
                            if (started.get() && server != null) {
                                server.start();
                                LOG.info("JMX consoles can connect to " + server.getAddress());
                            }
                        } catch (IOException e) {
                            LOG.warn("Failed to start jmx connector: " + e.getMessage());
                        }
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.