void (@NotNull Runnable task, @NotNull AsyncTreeModel model, long time, int count) { //noinspection SSBasedInspection SwingUtilities.invokeLater(() -> { if (model.isProcessing()) { invokeWhenProcessingDone(task, model, time, 0); } else if (count < 2) { invokeWhenProcessingDone(task, model, time, count + 1); } else { printTime("wait for ", time); task.run(); } }); }