boolean (@NotNull Ref<RunningInfo> ref, @NotNull Pair<Target, Parameters> key) { Info info; synchronized (myProcMap) { info = myProcMap.get(key); try { while (info != null && (!(info instanceof RunningInfo) || info.handler.isProcessTerminating() || info.handler.isProcessTerminated())) { myProcMap.wait(1000); ProgressManager.checkCanceled(); info = myProcMap.get(key); } } catch (InterruptedException e) { ProgressManager.checkCanceled(); } if (info == null) { myProcMap.put(key, new PendingInfo(ref, null)); } } if (info instanceof RunningInfo) { //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (ref) { ref.set((RunningInfo)info); ref.notifyAll(); } } return info != null; }