boolean (@NotNull ExternalSystemTaskId id) { Map<IntegrationKey, Pair<RemoteExternalSystemFacade, ExternalSystemExecutionSettings>> copy = new HashMap<>(myRemoteFacades); for (Map.Entry<IntegrationKey, Pair<RemoteExternalSystemFacade, ExternalSystemExecutionSettings>> entry : copy.entrySet()) { try { if (entry.getValue().first.isTaskInProgress(id)) { return true; } } catch (RemoteException e) { myLock.lock(); try { myRemoteFacades.remove(entry.getKey()); myFacadeWrappers.remove(entry.getKey()); } finally { myLock.unlock(); } } } return false; }