apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java/ConfigsImportService/doImport
class ConfigsImportService:  private void doImport(List<Env> importEnvs, List<String> toImportApps, List<String> toImportAppNSs,
                        List<String> toImportClusters, List<NamespaceImportData> toImportNSs)
      throws InterruptedException {
    currentUser = userInfoHolder.getUser().getUserId();

    LOGGER.info("Start to import app. size = {}", toImportApps.size());

    long startTime = System.currentTimeMillis();
    CountDownLatch appLatch = new CountDownLatch(toImportApps.size());
    toImportApps.parallelStream().forEach(app -> {
      try {
        importApp(app, importEnvs);
      } catch (Exception e) {
        LOGGER.error("import app error. app = {}", app, e);
      } finally {
        appLatch.countDown();
      }
    });
    appLatch.await();

    LOGGER.info("Finish to import app. duration = {}", System.currentTimeMillis() - startTime);
    LOGGER.info("Start to import appnamespace. size = {}", toImportAppNSs.size());

    startTime = System.currentTimeMillis();
    CountDownLatch appNSLatch = new CountDownLatch(toImportAppNSs.size());
    toImportAppNSs.parallelStream().forEach(appNS -> {
      try {
        importAppNamespace(appNS);
      } catch (Exception e) {
        LOGGER.error("import appnamespace error. appnamespace = {}", appNS, e);
      } finally {
        appNSLatch.countDown();
      }
    });
    appNSLatch.await();

    LOGGER.info("Finish to import appnamespace. duration = {}", System.currentTimeMillis() - startTime);
    LOGGER.info("Start to import cluster. size = {}", toImportClusters.size());

    startTime = System.currentTimeMillis();
    CountDownLatch clusterLatch = new CountDownLatch(toImportClusters.size());
    toImportClusters.parallelStream().forEach(cluster -> {
      try {
        importCluster(cluster, importEnvs);
      } catch (Exception e) {
        LOGGER.error("import cluster error. cluster = {}", cluster, e);
      } finally {
        clusterLatch.countDown();
      }
    });
    clusterLatch.await();

    LOGGER.info("Finish to import cluster. duration = {}", System.currentTimeMillis() - startTime);
    LOGGER.info("Start to import namespace. size = {}", toImportNSs.size());

    startTime = System.currentTimeMillis();
    CountDownLatch nsLatch = new CountDownLatch(toImportNSs.size());
    toImportNSs.parallelStream().forEach(namespace -> {
      try {
        importNamespaceFromText(namespace.getEnv(), namespace.getFileName(), namespace.getContent(),
                                namespace.isIgnoreConflictNamespace());
      } catch (Exception e) {
        LOGGER.error("import namespace error. namespace = {}", namespace, e);
      } finally {
        nsLatch.countDown();
      }
    });
    nsLatch.await();

    LOGGER.info("Finish to import namespace. duration = {}", System.currentTimeMillis() - startTime);
  }