Ejemplo n.º 1
0
  public MetricsObject call() {

    JMXReader node_reader = new JMXReader(this.ip_address, "" + this.jmx_port_number);
    MBeanServerConnection node_remote = null;
    try {
      node_remote = node_reader.connect();
    } catch (IOException e) {
      System.err.println(
          " - ERROR : There are communication problems when establishing the connection with the Cluster \n"
              + "           [ "
              + e.getMessage()
              + " ]");
      System.exit(-1);
    } catch (SecurityException e) {
      System.err.println(
          " - ERROR : There are security problems when establishing the connection with the Cluster \n"
              + "           [ "
              + e.getMessage()
              + " ]");
      System.exit(-1);
    } catch (Exception e) {
      System.err.println(
          " - ERROR : There are unknown problems when establishing the connection with the Cluster \n"
              + "           [ "
              + e.getMessage()
              + " ]");
      System.exit(-1);
    }

    // ---------- Retrieve Client Request Metrics ---------

    ClientRequestMetricsObject client_request_metrics_read =
        node_reader.getClientRequestLatencyMetrics(node_remote, "Read");

    ClientRequestMetricsObject client_request_metrics_write =
        node_reader.getClientRequestLatencyMetrics(node_remote, "Write");

    // ---------- Retrieve Node Metrics ---------

    NodeMetricsObject node_metrics_read =
        node_reader.getNodeLatencyMetrics(node_remote, "ReadLatency");

    NodeMetricsObject node_metrics_write =
        node_reader.getNodeLatencyMetrics(node_remote, "WriteLatency");

    // ----------

    node_reader.disconnect();

    MetricsObject metrics =
        new MetricsObject(
            ip_address,
            jmx_port_number,
            client_request_metrics_read,
            client_request_metrics_write,
            node_metrics_read,
            node_metrics_write);
    return (metrics);
  }