Example #1
0
  @Nullable
  private RunnerMetric getRunnerMetricByName(@NotNull String name) {
    if (descriptor == null) {
      return null;
    }

    for (RunnerMetric stat : descriptor.getRunStats()) {
      if (name.equals(stat.getName())) {
        return stat;
      }
    }

    return null;
  }
Example #2
0
  /** {@inheritDoc} */
  @NotNull
  @Override
  public String getStopTime() {
    if (isAlive()) {
      return TIMER_STUB;
    }

    RunnerMetric stopTimeMetric = getRunnerMetricByName(RunnerMetric.STOP_TIME);

    if (stopTimeMetric == null) {
      return TIMER_STUB;
    }

    String stopTime = stopTimeMetric.getValue();

    if (stopTime == null) {
      return TIMER_STUB;
    }
    double stopTimeMls = NUMBER_FORMAT.parse(stopTime);

    return DATE_TIME_FORMAT.format(new Date((long) stopTimeMls));
  }
Example #3
0
  @NotNull
  private String getLifeTime(@NotNull RunnerMetric lifeTimeMetric) {
    String lifeTimeValue = lifeTimeMetric.getValue();

    if (RunnerMetric.ALWAYS_ON.equals(lifeTimeValue)) {
      return lifeTimeValue;
    }

    if (lifeTimeValue == null) {
      return TIMER_STUB;
    }
    double lifeTime = NUMBER_FORMAT.parse(lifeTimeValue);

    return StringUtils.timeMlsToHumanReadable((long) lifeTime);
  }
Example #4
0
  @NotNull
  private String getTimeOut(@NotNull RunnerMetric timeoutMetric) {
    String timeout = timeoutMetric.getValue();

    if (RunnerMetric.ALWAYS_ON.equals(timeout)) {
      return timeout;
    }

    if (timeout == null) {
      return TIMER_STUB;
    }

    double terminationTime = NUMBER_FORMAT.parse(timeout);
    double terminationTimeout = terminationTime - System.currentTimeMillis();

    if (terminationTimeout <= 0) {
      return TIMER_STUB;
    }

    return StringUtils.timeMlsToHumanReadable((long) terminationTimeout);
  }