@Override
  public void updateIndex(MavenIndexId mavenIndexId, final MavenServerProgressIndicator indicator, boolean multithreaded, MavenToken token)
    throws RemoteException, MavenServerIndexerException, MavenServerProcessCanceledException {
    MavenServerUtil.checkToken(token);
    try {
      final IndexingContext index = getIndex(mavenIndexId);
      synchronized (index) {
        File repository = index.getRepository();
        if (repository != null) { // is local repository
          if (repository.exists()) {
            indicator.setIndeterminate(true);
            try {
              myIndexer.scan(index, new MyScanningListener(indicator), false);
            }
            finally {
              indicator.setIndeterminate(false);
            }
          }
        }
        else {
          final Maven3ServerEmbedder embedder = createEmbedder(new MavenServerSettings());

          MavenExecutionRequest r = embedder.createRequest(null, null, null);

          final IndexUpdateRequest request = new IndexUpdateRequest(index);

          try {
            embedder.executeWithMavenSession(r, () -> {
              request.setResourceFetcher(
                new Maven3ServerIndexFetcher(
                  index.getRepositoryId(), index.getRepositoryUrl(), embedder.getComponent(WagonManager.class),
                  embedder.getComponent(RepositorySystem.class), getWagonTransferListenerAdapter(indicator)
                )
              );
              try {
                myUpdater.fetchAndUpdateIndex(request);
              }
              catch (IOException e) {
                throw new RuntimeException(e);
              }
            });
          }
          finally {
            embedder.release(token);
          }
        }
      }
    }
    catch (RuntimeRemoteException e) {
      throw e.getCause();
    }
    catch (MavenProcessCanceledRuntimeException e) {
      throw new MavenServerProcessCanceledException();
    }
    catch (Exception e) {
      throw new MavenServerIndexerException(wrapException(e));
    }
  }
@Override
  public void updateIndex(MavenIndexId mavenIndexId, final MavenServerProgressIndicator indicator, boolean multithreaded, MavenToken token)