Examples of MetricsException


Examples of org.apache.hadoop.metrics2.MetricsException

        return newHisto;
      }
    }

    if (!(histo instanceof MetricMutableQuantiles)) {
      throw new MetricsException(
          "Metric already exists in registry for metric name: " + name
              + "and not of type MetricMutableQuantiles");
    }

    return (MetricMutableQuantiles) histo;
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

  }

  private <T> T returnExistingWithCast(MetricMutable metric,
      Class<T> metricClass, String name) {
    if (!metricClass.isAssignableFrom(metric.getClass())) {
      throw new MetricsException(
          "Metric already exists in registry for metric name: " + name
              + " and not of type " + metricClass);
    }

    return (T) metric;
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

      writer = filename == null
          ? new PrintWriter(System.out)
          : new PrintWriter(new FileWriter(new File(filename), true));
    }
    catch (Exception e) {
      throw new MetricsException("Error creating "+ filename, e);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

        try {
            // Open an connection to Graphite server.
            socket = new Socket(serverHost, serverPort);
            writer = new OutputStreamWriter(socket.getOutputStream());
        } catch (Exception e) {
            throw new MetricsException("Error creating connection, "
                    + serverHost + ":" + serverPort, e);
        }
    }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

        try {
            if(writer != null){
              writer.write(lines.toString());
            } else {
              throw new MetricsException("Writer in GraphiteSink is null!");
            }
        } catch (Exception e) {
            throw new MetricsException("Error sending metrics", e);
        }
    }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

    @Override
    public void flush() {
        try {
            writer.flush();
        } catch (Exception e) {
            throw new MetricsException("Error flushing metrics", e);
        }
    }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

      try {
        IOUtils.closeStream(writer);
        writer = null;
        LOG.info("writer in GraphiteSink is closed!");
      } catch (Throwable e){
        throw new MetricsException("Error closing writer", e);
      } finally {
        if (socket != null && !socket.isClosed()) {
          socket.close();
          socket = null;
          LOG.info("socket in GraphiteSink is closed!");
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

  @Override
  public synchronized void start() {
    checkNotNull(prefix, "prefix");
    if (monitoring) {
      LOG.warn(prefix +" metrics system already started!",
               new MetricsException("Illegal start"));
      return;
    }
    for (Callback cb : callbacks) cb.preStart();
    configure(prefix);
    startTimer();
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

  @Override
  public synchronized void stop() {
    if (!monitoring && !DefaultMetricsSystem.inMiniClusterMode()) {
      LOG.warn(prefix +" metrics system not yet started!",
               new MetricsException("Illegal stop"));
      return;
    }
    if (!monitoring) {
      // in mini cluster mode
      LOG.info(prefix +" metrics system stopped (again)");
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsException

      boolean extended, boolean returnExisting) {
    if (returnExisting) {
      MutableMetric rate = metricsMap.get(name);
      if (rate != null) {
        if (rate instanceof MutableRate) return (MutableRate) rate;
        throw new MetricsException("Unexpected metrics type "+ rate.getClass()
                                   +" for "+ name);
      }
    }
    MutableRate ret = new MutableRate(name, desc, extended);
    return addNewMetricIfAbsent(name, ret, MutableRate.class);
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.