void (@NotNull CompletableFuture<?> resultFuture, @NotNull Runnable pollAction) { ApplicationManagerEx.getApplicationEx().runUnlockingIntendedWrite(() -> { while (true) { try { resultFuture.get(10, TimeUnit.MILLISECONDS); } catch (TimeoutException ignore) { ApplicationManagerEx.getApplicationEx().runIntendedWriteActionOnCurrentThread(pollAction); continue; } catch (Throwable ignored) { } break; } return null; }); }