/** * Drops reader for the given {@link SegmentCommitInfo} if it's pooled * @return <code>true</code> if a reader is pooled */ synchronized boolean drop(SegmentCommitInfo info) throws IOException { final ReadersAndUpdates rld = readerMap.get(info); if (rld != null) { assert info == rld.info; readerMap.remove(info); rld.dropReaders(); return true; } return false; }
/** Remove all our references to readers, and commits * any pending changes. */ synchronized void dropAll() throws IOException { Throwable priorE = null; final Iterator<Map.Entry<SegmentCommitInfo,ReadersAndUpdates>> it = readerMap.entrySet().iterator(); while(it.hasNext()) { final ReadersAndUpdates rld = it.next().getValue(); // Important to remove as-we-go, not with .clear() // in the end, in case we hit an exception; // otherwise we could over-decref if close() is // called again: it.remove(); // NOTE: it is allowed that these decRefs do not // actually close the SRs; this happens when a // near real-time reader is kept open after the // IndexWriter instance is closed: try { rld.dropReaders(); } catch (Throwable t) { priorE = IOUtils.useOrSuppress(priorE, t); } } assert readerMap.size() == 0; if (priorE != null) { throw IOUtils.rethrowAlways(priorE); } }
rld.dropReaders(); readerMap.remove(rld.info); } else {
public synchronized void drop(SegmentCommitInfo info) throws IOException { final ReadersAndUpdates rld = readerMap.get(info); if (rld != null) { assert info == rld.info; // System.out.println("[" + Thread.currentThread().getName() + "] ReaderPool.drop: " + info); readerMap.remove(info); rld.dropReaders(); } }
public synchronized void drop(SegmentCommitInfo info) throws IOException { final ReadersAndUpdates rld = readerMap.get(info); if (rld != null) { assert info == rld.info; // System.out.println("[" + Thread.currentThread().getName() + "] ReaderPool.drop: " + info); readerMap.remove(info); rld.dropReaders(); } }
/** * Drops reader for the given {@link SegmentCommitInfo} if it's pooled * @return <code>true</code> if a reader is pooled */ synchronized boolean drop(SegmentCommitInfo info) throws IOException { final ReadersAndUpdates rld = readerMap.get(info); if (rld != null) { assert info == rld.info; readerMap.remove(info); rld.dropReaders(); return true; } return false; }
/** Remove all our references to readers, and commits * any pending changes. */ synchronized void dropAll() throws IOException { Throwable priorE = null; final Iterator<Map.Entry<SegmentCommitInfo,ReadersAndUpdates>> it = readerMap.entrySet().iterator(); while(it.hasNext()) { final ReadersAndUpdates rld = it.next().getValue(); // Important to remove as-we-go, not with .clear() // in the end, in case we hit an exception; // otherwise we could over-decref if close() is // called again: it.remove(); // NOTE: it is allowed that these decRefs do not // actually close the SRs; this happens when a // near real-time reader is kept open after the // IndexWriter instance is closed: try { rld.dropReaders(); } catch (Throwable t) { priorE = IOUtils.useOrSuppress(priorE, t); } } assert readerMap.size() == 0; if (priorE != null) { throw IOUtils.rethrowAlways(priorE); } }
rld.dropReaders(); } catch (Throwable t) { if (doSave) {
rld.dropReaders(); } catch (Throwable t) { if (doSave) {
rld.dropReaders(); readerMap.remove(rld.info);
rld.dropReaders(); readerMap.remove(rld.info);
rld.dropReaders(); readerMap.remove(rld.info); } else {