@Test public void initializationAlwaysFailsAfterTheFirstAsynchronousTry() { AlwaysFailingInitializer initializer = new AlwaysFailingInitializer(); initializer.initialize(true); assertThatThrownBy(() -> initializer.initialize(false)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("Multiple calls tried to initialize the same instance."); tickSchedulerFiveTimes(initializer); assertThat(initializer.initializationAttempts).isEqualTo(1 + FIVE); }
public final void initialize(boolean initializeAsync) { assertNeverCalledInitialize(); initializationStartTime = System.currentTimeMillis(); if (!initializeAsync) { tryInitializeInternal(); return; } tryInitializationLoop(); }
AsyncInitializer { public final void initialize(boolean initializeAsync) { assertNeverCalledInitialize(); initializationStartTime = System.currentTimeMillis(); if (!initializeAsync) { tryInitializeInternal(); return; } tryInitializationLoop(); } }
AsyncInitializer { public final void initialize(boolean initializeAsync) { assertNeverCalledInitialize(); initializationStartTime = System.currentTimeMillis(); if (!initializeAsync) { tryInitializeInternal(); return; } tryInitializationLoop(); }  }
AsyncInitializer { public final void initialize(boolean initializeAsync) { assertNeverCalledInitialize(); initializationStartTime = System.currentTimeMillis(); if (!initializeAsync) { tryInitializeInternal(); return; } tryInitializationLoop(); }  final void initialize(boolean initializeAsync); boolean isInitialized(); }
AsyncInitializer { public final void initialize(boolean initializeAsync) { assertNeverCalledInitialize(); initializationStartTime = System.currentTimeMillis(); if (!initializeAsync) { tryInitializeInternal(); return; } tryInitializationLoop(); }  final void initialize(boolean initializeAsync); boolean isInitialized();  }