StartSynchronizer { public synchronized void start() { if (!isStarting) { isStarting = true; startTimeMillis = System.currentTimeMillis(); completionLatch = new CountDownLatch(1); eventService.subscribe(runtimeStartInterrupter, KubernetesRuntimeStoppingEvent.class); eventService.subscribe(runtimeStopWatcher, KubernetesRuntimeStoppedEvent.class); } } @Inject  StartSynchronizer(
      EventService eventService,
      @Named("che.infra.kubernetes.workspace_start_timeout_min") int workspaceStartTimeoutMin,
      @Assisted RuntimeIdentity runtimeId); synchronized void start(); synchronized void setStartThread(); synchronized void complete(); synchronized void completeExceptionally(Exception ex); void checkFailure(); CompletableFuture<Void> getStartFailure(); synchronized boolean interrupt(); boolean awaitInterruption(long timeout, TimeUnit unit); boolean isCompleted(); InfrastructureException getStartFailureNow(); long getStartTimeoutMillis();  }
@Test public void shouldSubscribeOnRuntimeStoppingAndStoppedEventsWhenStartIsCalled() { startSynchronizer.start(); verify(eventService).subscribe(any(), eq(KubernetesRuntimeStoppingEvent.class)); verify(eventService).subscribe(any(), eq(KubernetesRuntimeStoppedEvent.class)); }
@Test public void shouldAddSubscribersAfterStart() throws Exception { runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace"); EventService eventService = new EventService(); startSynchronizer = new StartSynchronizer(eventService, 5, runtimeId); startSynchronizer.start(); assertSubscriberTypesNumber(eventService, 2); assertSubscribersNumber(eventService, KubernetesRuntimeStoppingEvent.class, 1); assertSubscribersNumber(eventService, KubernetesRuntimeStoppedEvent.class, 1); }