void stop() {
   if (started.compareAndSet(true, false)) {
     try {
       thread.isRunning = false;
       thread.interrupt();
       thread.join(TimeUnit.SECONDS.toMillis(5));
     } catch (InterruptedException e) {
       EmptyStatement.ignore(e);
     }
   }
 }
 boolean hasCriticalFailure(Set<Failure.Type> nonCriticalFailures) {
   if (!started.get()) {
     throw new IllegalStateException("FailureMonitor has not been started!");
   }
   return thread.hasCriticalFailure(nonCriticalFailures);
 }
 int getFailureCount() {
   if (!started.get()) {
     throw new IllegalStateException("FailureMonitor has not been started!");
   }
   return thread.getFailureCount();
 }
 void start() {
   if (started.compareAndSet(false, true)) {
     thread.start();
   }
 }