Examples of MonitorConf


Examples of com.thenetcircle.comsumerdispatcher.config.MonitorConf

    return allJobs;
  }

  @Override
  public MonitorConf loadJmxConfig() {
    MonitorConf mc = new MonitorConf();
    String rmiPort = "9999";;
    try {
      rmiPort = getNodeValue(DistributionTreeConstants.MONITOR_RPORT);
    } catch (Exception e1) {
      _logger.error(e1, e1);
    }
    String httpPort = "8888";;
    try {
      httpPort = getNodeValue(DistributionTreeConstants.MONITOR_HTTPPORT);
    } catch (Exception e1) {
      _logger.error(e1, e1);
    }
    String hostname = HttpUtil.getLocalHostName();
    mc.setJmxHttpHost(hostname);
    mc.setJmxHttpPort(Integer.valueOf(httpPort));
    mc.setJmxRmiHost(hostname);
    mc.setJmxRmiPort(Integer.valueOf(rmiPort));
    return mc;
  }
View Full Code Here

Examples of com.thenetcircle.comsumerdispatcher.config.MonitorConf

    }
    maybeEnableJMXHttp();
  }
 
  protected static void enableJMXRmi() throws IOException {
    MonitorConf config = DispatcherConfig.getInstance().getMonitorConf();
   
    LocateRegistry.createRegistry(config.getJmxRmiPort());
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
   
    String address = String.format(fmtUrl, config.getJmxRmiHost(), config.getJmxRmiPort());
    JMXServiceURL url = new JMXServiceURL(address);
    JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, server);
    cs.start();
   
    _logger.info("JMX enabled on:" + address);
View Full Code Here

Examples of com.thenetcircle.comsumerdispatcher.config.MonitorConf

  /**
   * enabled if mx4j is in classpath
   */
  protected static boolean maybeEnableJMXHttp() {
        try {
          MonitorConf config = DispatcherConfig.getInstance().getMonitorConf();
            MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
            ObjectName processorName = new ObjectName("Server:name=XSLTProcessor");

            Class<?> httpAdaptorClass = Class.forName("mx4j.tools.adaptor.http.HttpAdaptor");
            Object httpAdaptor = httpAdaptorClass.newInstance();
            httpAdaptorClass.getMethod("setHost", String.class).invoke(httpAdaptor, config.getJmxHttpHost());
            httpAdaptorClass.getMethod("setPort", Integer.TYPE).invoke(httpAdaptor, config.getJmxHttpPort());

            ObjectName httpName = new ObjectName("system:name=http");
            mbs.registerMBean(httpAdaptor, httpName);

            Class<?> xsltProcessorClass = Class.forName("mx4j.tools.adaptor.http.XSLTProcessor");
            Object xsltProcessor = xsltProcessorClass.newInstance();
            httpAdaptorClass.getMethod("setProcessor", Class.forName("mx4j.tools.adaptor.http.ProcessorMBean")).
                    invoke(httpAdaptor, xsltProcessor);
            mbs.registerMBean(xsltProcessor, processorName);
            httpAdaptorClass.getMethod("start").invoke(httpAdaptor);

            _logger.info("mx4j successfuly loaded at  " + config.getJmxHttpHost() + ":" + config.getJmxHttpPort());
            return true;
        }
        catch (ClassNotFoundException e)
        {
          _logger.info("Will not load MX4J, mx4j-tools.jar is not in the classpath");
View Full Code Here

Examples of com.thenetcircle.comsumerdispatcher.config.MonitorConf

    }
   
  }
 
  public void populateMonitorData(ZooKeeper zk) throws KeeperException, InterruptedException {
    MonitorConf mc = DispatcherConfig.getInstance().getMonitorConf();
    createNode(zk, DistributionTreeConstants.MONITOR, "monitoring config");
    createNode(zk, DistributionTreeConstants.MONITOR_RHOST, ""); // doesnt make sense to share
    createNode(zk, DistributionTreeConstants.MONITOR_RPORT, String.valueOf(mc.getJmxRmiPort()));
    createNode(zk, DistributionTreeConstants.MONITOR_HTTPHOST, ""); // doesnt make sense to share
    createNode(zk, DistributionTreeConstants.MONITOR_HTTPPORT, String.valueOf(mc.getJmxHttpPort()));
   
  }
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.