コード例 #1
0
  /**
   * After all files are ingested, execute final index commit and final search Cleanup resources,
   * threads, timers
   */
  @Override
  public void complete() {
    if (initialized == false) {
      return;
    }

    // logger.log(Level.INFO, "complete()");
    commitTimer.stop();

    // handle case if previous search running
    // cancel it, will re-run after final commit
    // note: cancellation of Searcher worker is graceful (between keywords)
    if (currentSearcher != null) {
      currentSearcher.cancel(false);
    }

    // cancel searcher timer, ensure unwanted searcher does not start
    // before we start the final one
    if (searchTimer.isRunning()) {
      searchTimer.stop();
    }
    runSearcher = false;

    logger.log(Level.INFO, "Running final index commit and search");
    // final commit
    commit();

    postIndexSummary();

    // run one last search as there are probably some new files committed
    if (keywords != null && !keywords.isEmpty() && processedFiles == true) {
      finalSearcher = new Searcher(keywords, true); // final searcher run
      finalSearcher.execute();
    } else {
      finalSearcherDone = true;
      managerProxy.postMessage(
          IngestMessage.createMessage(++messageID, MessageType.INFO, this, "Completed"));
    }

    // postSummary();
  }
コード例 #2
0
  /** Handle stop event (ingest interrupted) Cleanup resources, threads, timers */
  @Override
  public void stop() {
    logger.log(Level.INFO, "stop()");

    // stop timer
    commitTimer.stop();
    // stop currentSearcher
    if (currentSearcher != null) {
      currentSearcher.cancel(true);
    }

    // cancel searcher timer, ensure unwanted searcher does not start
    if (searchTimer.isRunning()) {
      searchTimer.stop();
    }
    runSearcher = false;
    finalSearcherDone = true;

    // commit uncommited files, don't search again
    commit();

    // postSummary();
  }