Exemplo n.º 1
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);
  }
Exemplo n.º 2
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);
  }