private @NotNull RemoteExternalSystemFacade doGetFacade(@NotNull IntegrationKey key, @NotNull Project project) throws Exception {
    var externalSystemId = key.getExternalSystemId();
    var communicationManager = getCommunicationManager(externalSystemId);
    var manager = ExternalSystemApiUtil.getManager(externalSystemId);
    if (project.isDisposed() || manager == null) {
      return RemoteExternalSystemFacade.NULL_OBJECT;
    }
    Pair<RemoteExternalSystemFacade, ExternalSystemExecutionSettings> pair = myRemoteFacades.get(key);
    if (pair != null && prepare(communicationManager, project, key, pair)) {
      return pair.first;
    }

    myLock.lock();
    try {
      pair = myRemoteFacades.get(key);
      if (pair != null && prepare(communicationManager, project, key, pair)) {
        return pair.first;
      }
      if (pair != null) {
        myFacadeWrappers.clear();
        myRemoteFacades.clear();
      }
      return doCreateFacade(key, project, communicationManager);
    }
    finally {
      myLock.unlock();
    }
  }
private @NotNull RemoteExternalSystemFacade doGetFacade(@NotNull IntegrationKey key, @NotNull Project project)