@Override
  public synchronized void start() {
    LOG.info("Starting {}", this.getClass().getSimpleName());
    Preconditions.checkState(mJvmPauseMonitor == null, "JVM pause monitor must not already exist");
    mJvmPauseMonitor = new JvmPauseMonitor(
        Configuration.getMs(PropertyKey.JVM_MONITOR_SLEEP_INTERVAL_MS),
        Configuration.getMs(PropertyKey.JVM_MONITOR_WARN_THRESHOLD_MS),
        Configuration.getMs(PropertyKey.JVM_MONITOR_INFO_THRESHOLD_MS));
    mJvmPauseMonitor.start();
    MetricsSystem.registerGaugeIfAbsent(
        MetricsSystem.getMetricName(MetricKey.TOTAL_EXTRA_TIME.getName()),
        mJvmPauseMonitor::getTotalExtraTime);
    MetricsSystem.registerGaugeIfAbsent(
        MetricsSystem.getMetricName(MetricKey.INFO_TIME_EXCEEDED.getName()),
        mJvmPauseMonitor::getInfoTimeExceeded);
    MetricsSystem.registerGaugeIfAbsent(
        MetricsSystem.getMetricName(MetricKey.WARN_TIME_EXCEEDED.getName()),
        mJvmPauseMonitor::getWarnTimeExceeded);
  }
@Test
  public void doubleStart() {
    Configuration.set(PropertyKey.MASTER_JVM_MONITOR_ENABLED, true);
    SimpleService service = JvmMonitorService.Factory.create();
    Assert.assertTrue(service instanceof JvmMonitorService);

    service.start();
    Assert.assertThrows("JVM pause monitor must not already exist",
        IllegalStateException.class, service::start);
  }