Пример #1
0
  /**
   * Setups up the parallel parsing environment and blocks until parsing has finished (successfully
   * or with an error).
   */
  public void startParsing(Set<BuildTarget> toExplore, ParserConfig parserConfig, Executor executor)
      throws InterruptedException {
    Preconditions.checkArgument(
        completionNotifier.getCount() == 1,
        "Only one invocation of `startParsing` allowed until completion");
    addBuildTargetsToProcess(toExplore);

    // Create the worker threads.
    for (int i = parserConfig.getNumParsingThreads(); i > 0; i--) {
      executor.execute(new BuildTargetParserWorker());
    }

    // Now we wait for parsing to complete.
    completionNotifier.await();
  }