@Test public void shouldStartLoggerIfNotRunningAndFails() { assertThat(asyncRunner.hasDelayedActions()).isFalse(); eth1StatusLogger.fail(); assertThat(asyncRunner.hasDelayedActions()).isTrue(); }
synchronized void fail() { if (activeReporter.isEmpty()) { final UInt64 outageStartInSeconds = timeProvider.getTimeInSeconds(); final Cancellable reporter = asyncRunner.runWithFixedDelay( () -> reportOutage(outageStartInSeconds), LOG_INTERVAL, TimeUnit.MILLISECONDS, error -> LOG.error("Failed to check Eth1 status", error)); activeReporter = Optional.of(reporter); } }
Eth1StatusLogger { synchronized void fail() { if (activeReporter.isEmpty()) { final UInt64 outageStartInSeconds = timeProvider.getTimeInSeconds(); final Cancellable reporter = asyncRunner.runWithFixedDelay( () -> reportOutage(outageStartInSeconds), LOG_INTERVAL, TimeUnit.MILLISECONDS, error -> LOG.error("Failed to check Eth1 status", error)); activeReporter = Optional.of(reporter); } } }
Eth1StatusLogger { synchronized void fail() { if (activeReporter.isEmpty()) { final UInt64 outageStartInSeconds = timeProvider.getTimeInSeconds(); final Cancellable reporter = asyncRunner.runWithFixedDelay( () -> reportOutage(outageStartInSeconds), LOG_INTERVAL, TimeUnit.MILLISECONDS, error -> LOG.error("Failed to check Eth1 status", error)); activeReporter = Optional.of(reporter); } } Eth1StatusLogger(final AsyncRunner asyncRunner, final TimeProvider timeProvider); }
Eth1StatusLogger { synchronized void fail() { if (activeReporter.isEmpty()) { final UInt64 outageStartInSeconds = timeProvider.getTimeInSeconds(); final Cancellable reporter = asyncRunner.runWithFixedDelay( () -> reportOutage(outageStartInSeconds), LOG_INTERVAL, TimeUnit.MILLISECONDS, error -> LOG.error("Failed to check Eth1 status", error)); activeReporter = Optional.of(reporter); } } Eth1StatusLogger(final AsyncRunner asyncRunner, final TimeProvider timeProvider);  }
Eth1StatusLogger { synchronized void fail() { if (activeReporter.isEmpty()) { final UInt64 outageStartInSeconds = timeProvider.getTimeInSeconds(); final Cancellable reporter = asyncRunner.runWithFixedDelay( () -> reportOutage(outageStartInSeconds), LOG_INTERVAL, TimeUnit.MILLISECONDS, error -> LOG.error("Failed to check Eth1 status", error)); activeReporter = Optional.of(reporter); } } Eth1StatusLogger(final AsyncRunner asyncRunner, final TimeProvider timeProvider);   }