Examples of JMXServiceURL


Examples of javax.management.remote.JMXServiceURL

        final int port = result.get("step-1", RESULT, SOCKET_BINDING, "jmx-connector-registry", PORT).asInt() + portOffset;

        final String addr = "localhost"; // TODO determine the interface binding

        String url = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", addr, port);
        return JMXConnectorFactory.connect(new JMXServiceURL(url),
                new HashMap<String, Object>()).getMBeanServerConnection();
    }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    return Collectd.getHostname();
  } /* }}} String getHost */

private void connect () /* {{{ */
{
  JMXServiceURL service_url;
  JMXConnector connector;
  Map environment;

  if (_jmx_connection != null)
    return;

  environment = null;
  if (this._password != null)
  {
    String[] credentials;

    if (this._username == null)
      this._username = new String ("monitorRole");

    credentials = new String[] { this._username, this._password };

    environment = new HashMap ();
    environment.put (JMXConnector.CREDENTIALS, credentials);
    environment.put(JMXConnectorFactory.PROTOCOL_PROVIDER_CLASS_LOADER, this.getClass().getClassLoader());
  }

  try
  {
    service_url = new JMXServiceURL (this._service_url);
    connector = JMXConnectorFactory.connect (service_url, environment);
    _jmx_connection = connector.getMBeanServerConnection ();
  }
  catch (Exception e)
  {
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    return (0);
  } /* }}} int config */

  public int init () /* {{{ */
  {
    JMXServiceURL service_url;
    JMXConnector connector;
    MBeanServerConnection connection;

    if (_jmx_service_url == null)
    {
      Collectd.logError ("JMXMemory: _jmx_service_url == null");
      return (-1);
    }

    try
    {
      service_url = new JMXServiceURL (_jmx_service_url);
      connector = JMXConnectorFactory.connect (service_url);
      connection = connector.getMBeanServerConnection ();
      _mbean = ManagementFactory.newPlatformMXBeanProxy (connection,
          ManagementFactory.MEMORY_MXBEAN_NAME,
          MemoryMXBean.class);
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    public void init() throws Exception {
        if (this.server == null) {
            throw new IllegalArgumentException("server must be set");
        }
        JMXServiceURL url = new JMXServiceURL(this.serviceUrl);

        if (isClientAuth()) {
            this.secured = true;
        }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

      throws Exception {
    addRemoteServer("service:jmx:rmi:///jndi/rmi://" + host + ":" + port +"/" +path);
  }

  public void addRemoteServer(String url) throws Exception {
    JMXServiceURL u = new JMXServiceURL(url);
    MBeanServerConnection s = JMXConnectorFactory.connect(u)
        .getMBeanServerConnection();
    add(url, s);
  }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

  private static JMXConnectorServer cs = null;
  private static final Logger log = Logger.getLogger(TestJmxAppender.class.getName());

  private static JMXServiceURL getJmxServiceURL() {
    try {
      return new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + port + "/jmxapitestrmi");
    } catch(Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

      RmiConnectorActivator.log(LogService.LOG_DEBUG,"JMXServiceURL for binding is: '" + url + "'",null);

      if (isEncodedForm(url))
      {
         String path = encodeStub(rmiServer, environment);
         return new JMXServiceURL(url.getProtocol(), url.getHost(), url.getPort(), path);
      }

      String jndiURL = parseJNDIForm(url);
      RmiConnectorActivator.log(LogService.LOG_DEBUG,"JMXServiceURL path for binding is: '" + jndiURL + "'", null);
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

        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;
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

            .append("If you are using debian-based distros, try editing the /etc/hosts file so that it does not contain")
            .append(" something like '127.0.0.1 ${hostname}'");
       this.ac.warning(msg.toString());
       address=InetAddress.getLocalHost();
     }
     JMXServiceURL url = new JMXServiceURL(
             "service:jmx:rmi:///jndi/rmi://"+address.getHostName()+":"
                     + this.port + "/server");
             this.ac.debug(url.toString());                       
     this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(
             url, null,this.server);

     this.server.registerMBean(this.connectorServer, new ObjectName(connectorServerOname));
     this.connectorServer.start();
View Full Code Here

Examples of javax.management.remote.JMXServiceURL

    RmiConnectorActivator.log(LogService.LOG_INFO, "jmx connexion string ==> "+url, null);
   
    RmiConnectorActivator.log(LogService.LOG_INFO, "Starting JMX Rmi Connector "+version,null);
    this.mbs=(MBeanServer)bc.getService(this.mBeanServerSR);
    this.nsi=(NamingServiceIfc)bc.getService(this.namingServiceIfcSR);
    JMXServiceURL address=new JMXServiceURL(url);
/*
    Map environment = new HashMap();
    environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
    environment.put(Context.PROVIDER_URL, "rmi://localhost:"+rmiPort);
    environment.put(JMXConnectorServerFactory.PROTOCOL_PROVIDER_CLASS_LOADER,this.getClass().getClassLoader());
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.