List of usage examples for org.apache.lucene.index IndexReader hashCode
@Override public final int hashCode()
IndexReader subclasses are not allowed to implement equals/hashCode, so methods are declared final.
From source file:org.weborganic.flint.SearcherManager.java
License:artistic-license-2.0
/** * Check if the reader provided is not current and not used anymore in which case it is closed. * * @param reader the reader to check/*from w w w .j a v a2s .com*/ * * @throws IOException if closing failed */ private void closeIfDirty(IndexReader reader) throws IOException { // check if we should close an old one if (this.currentSearcher.getIndexReader() != reader) { if (reader.getRefCount() == 0) { LOGGER.debug("Closing reader {}", reader.hashCode()); try { reader.close(); } catch (AlreadyClosedException e) { // good then, no need to worry } } else { LOGGER.debug("Cannot close reader {} as there are still references ({})", reader.hashCode(), reader.getRefCount()); } } }
From source file:org.weborganic.flint.SearcherManager.java
License:artistic-license-2.0
/** * Release the given reader.// ww w.j a v a 2s . c om * * @param reader the reader to release * * @throws IOException If thrown when attempting to close the reader, when reader is no longer in use. */ protected synchronized void releaseReader(IndexReader reader) throws IOException { LOGGER.debug("Releasing reader {}", reader.hashCode()); reader.decRef(); // check if we should close an old one closeIfDirty(reader); }