void (@NotNull Runnable runnable, @Nullable Runnable finalizeRunnable) { boolean wasRemoved; synchronized (myActiveWorkerTasks) { wasRemoved = myActiveWorkerTasks.remove(runnable); } if (wasRemoved && finalizeRunnable != null) { finalizeRunnable.run(); } invokeLaterIfNeeded(false, new TreeRunnable("AbstractTreeUi.unregisterWorkerTask") { @Override public void perform() { maybeReady(); } }); }