@Override protected boolean tryIncRef(IndexSearcher reference) { return reference.getIndexReader().tryIncRef(); }
/** * Expert: increments the refCount of this IndexReader * instance. RefCounts are used to determine when a * reader can be closed safely, i.e. as soon as there are * no more references. Be sure to always call a * corresponding {@link #decRef}, in a finally clause; * otherwise the reader may never be closed. Note that * {@link #close} simply calls decRef(), which means that * the IndexReader will not really be closed until {@link * #decRef} has been called for all outstanding * references. * * @see #decRef * @see #tryIncRef */ public final void incRef() { if (!tryIncRef()) { ensureOpen(); } }
/** Retrieve a previously recorded {@link IndexSearcher}, if it * has not yet been closed * * <p><b>NOTE</b>: this may return null when the * requested searcher has already timed out. When this * happens you should notify your user that their session * timed out and that they'll have to restart their * search. * * <p>If this returns a non-null result, you must match * later call {@link #release} on this searcher, best * from a finally clause. */ public IndexSearcher acquire(long version) { ensureOpen(); final SearcherTracker tracker = searchers.get(version); if (tracker != null && tracker.searcher.getIndexReader().tryIncRef()) { return tracker.searcher; } return null; }
@Override protected boolean tryIncRef(IndexSearcher reference) { return reference.getIndexReader().tryIncRef(); }
@Override protected boolean tryIncRef(IndexSearcher reference) { return reference.getIndexReader().tryIncRef(); }
@Override protected boolean tryIncRef(IndexSearcher reference) { return reference.getIndexReader().tryIncRef(); }
@Override protected boolean tryIncRef(IndexSearcher reference) { return reference.getIndexReader().tryIncRef(); }
@Override protected boolean tryIncRef(IndexSearcher reference) { return reference.getIndexReader().tryIncRef(); }
/** * Expert: increments the refCount of this IndexReader * instance. RefCounts are used to determine when a * reader can be closed safely, i.e. as soon as there are * no more references. Be sure to always call a * corresponding {@link #decRef}, in a finally clause; * otherwise the reader may never be closed. Note that * {@link #close} simply calls decRef(), which means that * the IndexReader will not really be closed until {@link * #decRef} has been called for all outstanding * references. * * @see #decRef * @see #tryIncRef */ public final void incRef() { if (!tryIncRef()) { ensureOpen(); } }
/** * Expert: increments the refCount of this IndexReader * instance. RefCounts are used to determine when a * reader can be closed safely, i.e. as soon as there are * no more references. Be sure to always call a * corresponding {@link #decRef}, in a finally clause; * otherwise the reader may never be closed. Note that * {@link #close} simply calls decRef(), which means that * the IndexReader will not really be closed until {@link * #decRef} has been called for all outstanding * references. * * @see #decRef * @see #tryIncRef */ public final void incRef() { if (!tryIncRef()) { ensureOpen(); } }
/** * Expert: increments the refCount of this IndexReader * instance. RefCounts are used to determine when a * reader can be closed safely, i.e. as soon as there are * no more references. Be sure to always call a * corresponding {@link #decRef}, in a finally clause; * otherwise the reader may never be closed. Note that * {@link #close} simply calls decRef(), which means that * the IndexReader will not really be closed until {@link * #decRef} has been called for all outstanding * references. * * @see #decRef * @see #tryIncRef */ public final void incRef() { if (!tryIncRef()) { ensureOpen(); } }
/** Retrieve a previously recorded {@link IndexSearcher}, if it * has not yet been closed * * <p><b>NOTE</b>: this may return null when the * requested searcher has already timed out. When this * happens you should notify your user that their session * timed out and that they'll have to restart their * search. * * <p>If this returns a non-null result, you must match * later call {@link #release} on this searcher, best * from a finally clause. */ public IndexSearcher acquire(long version) { ensureOpen(); final SearcherTracker tracker = searchers.get(version); if (tracker != null && tracker.searcher.getIndexReader().tryIncRef()) { return tracker.searcher; } return null; }
@Nullable LuceneIndexNode acquire() { lock.readLock().lock(); if (closed) { lock.readLock().unlock(); return null; } else { boolean success = false; try { refreshPolicy.refreshOnReadIfRequired(refreshCallback); SearcherHolder local = searcherHolder; int tryCount = 0; while (!local.searcher.getIndexReader().tryIncRef()) { checkState(++tryCount < 10, "Not able to " + "get open searcher in %s attempts", tryCount); local = searcherHolder; } LuceneIndexNode indexNode = new IndexNodeImpl(local); success = true; return indexNode; } finally { if (!success) { lock.readLock().unlock(); } } } }
/** Retrieve a previously recorded {@link IndexSearcher}, if it * has not yet been closed * * <p><b>NOTE</b>: this may return null when the * requested searcher has already timed out. When this * happens you should notify your user that their session * timed out and that they'll have to restart their * search. * * <p>If this returns a non-null result, you must match * later call {@link #release} on this searcher, best * from a finally clause. */ public IndexSearcher acquire(long version) { ensureOpen(); final SearcherTracker tracker = searchers.get(version); if (tracker != null && tracker.searcher.getIndexReader().tryIncRef()) { return tracker.searcher; } return null; }
@Nullable LuceneIndexNode acquire() { lock.readLock().lock(); if (closed) { lock.readLock().unlock(); return null; } else { boolean success = false; try { refreshPolicy.refreshOnReadIfRequired(refreshCallback); SearcherHolder local = searcherHolder; int tryCount = 0; while (!local.searcher.getIndexReader().tryIncRef()) { checkState(++tryCount < 10, "Not able to " + "get open searcher in %s attempts", tryCount); local = searcherHolder; } LuceneIndexNode indexNode = new IndexNodeImpl(local); success = true; return indexNode; } finally { if (!success) { lock.readLock().unlock(); } } } }
/** Retrieve a previously recorded {@link IndexSearcher}, if it * has not yet been closed * * <p><b>NOTE</b>: this may return null when the * requested searcher has already timed out. When this * happens you should notify your user that their session * timed out and that they'll have to restart their * search. * * <p>If this returns a non-null result, you must match * later call {@link #release} on this searcher, best * from a finally clause. */ public IndexSearcher acquire(long version) { ensureOpen(); final SearcherTracker tracker = searchers.get(version); if (tracker != null && tracker.searcher.getIndexReader().tryIncRef()) { return tracker.searcher; } return null; }
@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; }
@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; }