/** * Closes files associated with this index. * Also saves any new deletions to disk. * No other methods should be called after this has been called. * @throws IOException if there is a low-level IO error */ @Override public final synchronized void close() throws IOException { if (!closed) { decRef(); closed = true; } }
@Override protected synchronized void doClose() throws IOException { IOException ioe = null; for (final IndexReader reader : completeReaderSet) { try { if (closeSubReaders) { reader.close(); } else { reader.decRef(); } } catch (IOException e) { if (ioe == null) ioe = e; } } // throw the first exception if (ioe != null) throw ioe; } }
@Override public synchronized void close() throws IOException { searcher.getIndexReader().decRef(); } }
/** Release a searcher previously obtained from {@link * #acquire}. * * <p><b>NOTE</b>: it's fine to call this after close. */ public void release(IndexSearcher s) throws IOException { s.getIndexReader().decRef(); }
@Override protected void decRef(IndexSearcher reference) throws IOException { reference.getIndexReader().decRef(); }
@Override protected synchronized void doClose() throws IOException { IOException ioe = null; for (final IndexReader r : getSequentialSubReaders()) { try { if (closeSubReaders) { r.close(); } else { r.decRef(); } } catch (IOException e) { if (ioe == null) ioe = e; } } // throw the first exception if (ioe != null) throw ioe; } }
/** Expert: creates a searcher from the provided {@link * IndexReader} using the provided {@link * SearcherFactory}. NOTE: this decRefs incoming reader * on throwing an exception. */ public static IndexSearcher getSearcher(SearcherFactory searcherFactory, IndexReader reader, IndexReader previousReader) throws IOException { boolean success = false; final IndexSearcher searcher; try { searcher = searcherFactory.newSearcher(reader, previousReader); if (searcher.getIndexReader() != reader) { throw new IllegalStateException("SearcherFactory must wrap exactly the provided reader (got " + searcher.getIndexReader() + " but expected " + reader + ")"); } success = true; } finally { if (!success) { reader.decRef(); } } return searcher; } }
public void returnReader(final IndexReader reader) throws IOException { reader.decRef(); }
@Override protected void decRef(IndexSearcher reference) throws IOException { reference.getIndexReader().decRef(); } }
/** * We want to avoid setting the closed flag on our wrapped stream, passing on all decrefs. **/ @Override protected void doClose() throws IOException { in.decRef(); }
/** * Closes files associated with this index. * Also saves any new deletions to disk. * No other methods should be called after this has been called. * @throws IOException if there is a low-level IO error */ public final synchronized void close() throws IOException { if (!closed) { decRef(); closed = true; } }
/** Release a searcher previously obtained from {@link * #acquire}. * * <p><b>NOTE</b>: it's fine to call this after close. */ public void release(IndexSearcher s) throws IOException { s.getIndexReader().decRef(); }
/** Release a searcher previously obtained from {@link * #acquire}. * * <p><b>NOTE</b>: it's fine to call this after close. */ public void release(IndexSearcher s) throws IOException { s.getIndexReader().decRef(); }
private void decrementSearcherUsageCount(IndexSearcher searcher) { try { //Decrement the count by 1 as we increased it while creating the searcher //in createReader searcher.getIndexReader().decRef(); } catch (IOException e) { log.warn("Error occurred while releasing reader for index [{}]", definition.getIndexPath(), e); } }
private void decrementReaderUseCount(IndexReader reader) { try { if (reader != null) { reader.decRef(); } } catch (IOException e) { log.warn("[{}] Error occurred while releasing reader instance {}", definition.getIndexPath(), toString(), e); } }
private void decrementReaderUseCount(IndexReader reader) { try { if (reader != null) { reader.decRef(); } } catch (IOException e) { log.warn("[{}] Error occurred while releasing reader instance {}", definition.getIndexPath(), toString(), e); } }
private void decrementSearcherUsageCount(IndexSearcher searcher) { try { //Decrement the count by 1 as we increased it while creating the searcher //in createReader searcher.getIndexReader().decRef(); } catch (IOException e) { log.warn("Error occurred while releasing reader for index [{}]", definition.getIndexPath(), e); } }
@Override protected void decRef(SearcherAndTaxonomy ref) throws IOException { ref.searcher.getIndexReader().decRef(); // This decRef can fail, and then in theory we should // tryIncRef the searcher to put back the ref count // ... but 1) the below decRef should only fail because // it decRef'd to 0 and closed and hit some IOException // during close, in which case 2) very likely the // searcher was also just closed by the above decRef and // a tryIncRef would fail: ref.taxonomyReader.decRef(); }
private void decReaderRef() throws IOException { searcher.getIndexReader().decRef(); Counter searcherLuceneCloseInstrument = Instrumentation.pullCounter(InstrumentationName.SEARCHER_LUCENE_CLOSE); searcherLuceneCloseInstrument.incrementAndGet(); } }
@Override protected boolean tryIncRef(SearcherAndTaxonomy ref) throws IOException { if (ref.searcher.getIndexReader().tryIncRef()) { if (ref.taxonomyReader.tryIncRef()) { return true; } else { ref.searcher.getIndexReader().decRef(); } } return false; }