Пример #1
0
  /**
   * Disposes of the receiver. The caller should make sure that no more search requests are
   * submitted to the receiver after this method is called.
   */
  @ThreadSafe
  public void shutdown() {
    if (ioException != null) Util.printErr(ioException);

    writeLock.lock();
    try {
      indexRegistry.removeListeners(addedListener, null);
      Closeables.closeQuietly(luceneSearcher);
    } finally {
      writeLock.unlock();
    }

    /*
     * This should be done after closing the Lucene searcher in order to
     * ensure that no indexes will be deleted outside the deletion queue
     * while the Lucene searcher is still open.
     */
    synchronized (this) {
      deletionThread.interrupt();
    }
  }