示例#1
0
 @Override
 public void drop() throws IOException {
   taskCoordinator.cancel();
   closeIndexResources();
   try {
     taskCoordinator.awaitCompletion();
   } catch (InterruptedException e) {
     throw new IOException("Interrupted while waiting for concurrent tasks to complete.", e);
   }
   deleteDirectoryContents(dir);
 }
示例#2
0
 @Override
 public IndexReader newReader() {
   final IndexSearcher searcher = searcherManager.acquire();
   final TaskControl token = taskCoordinator.newInstance();
   final Closeable closeable =
       new Closeable() {
         @Override
         public void close() throws IOException {
           searcherManager.release(searcher);
           token.close();
         }
       };
   return makeNewReader(searcher, closeable, token);
 }