void (@NotNull Runnable runnable, @NotNull BooleanSupplier condition) { CountDownLatch latch = new CountDownLatch(1); invokeAndWaitForLatch(latch, () -> { runnable.run(); latch.countDown(); }); try { while (!condition.getAsBoolean()) { //noinspection BusyWait Thread.sleep(100); } } catch (InterruptedException e) { throw new RuntimeException(e); } }