public void returnIndexReaders(List<ZoieIndexReader<R>> readers) { for(ZoieIndexReader<R> r : readers) { // try // { r.decZoieRef();//.decRef(); // } catch (IOException e) // { // log.error("error when decRef on reader ", e); // } } }
oldDiskReader.decZoieRef();
/** * The readers removed will also be decRef(). But the readers to be added will NOT get incRef(), * which means we assume the newly added ones have already been incRef(). * remove and add should be <b>disjoint</b> * @param remove the readers to be remove. This has to be disjoint from add. * @param add */ public synchronized void swapArchives(List<ZoieIndexReader<R>> remove, List<ZoieIndexReader<R>> add) { List<ZoieIndexReader<R>> archives = new LinkedList<ZoieIndexReader<R>>(add); if (!box._archives.containsAll(remove)) { log.error("swapArchives: potential sync issue. "); } archives.addAll(box._archives); archives.removeAll(remove); for(ZoieIndexReader<R> r : remove) { r.decZoieRef(); if (log.isDebugEnabled()) { log.debug("remove time " + r.directory() + " refCount: " + r.getRefCount()); } } Box<R, D> newbox = new Box<R, D>(archives, box._archiveZoies, box._retiree, box._actives, _decorator); box = newbox; }
public int getNumdocs() { ZoieIndexReader<R> reader = null; try { synchronized(this) { reader = openIndexReader(); if (reader == null) return 0; reader.incZoieRef(); } return reader.numDocs(); } catch(IOException e) { log.error(e.getMessage(), e); } finally { if (reader != null) reader.decZoieRef(); } return 0; }
public void commitDeletes() throws IOException { ZoieIndexReader<R> reader = null; synchronized(this) { reader = openIndexReader(); if(reader == null) return; reader.incZoieRef(); } reader.commitDeletes(); reader.decZoieRef(); }
public void close() { super.close(); if (_currentReader != null) { _currentReader.decZoieRef(); } if (_directory != null) { try { _directory.close(); if (_backingdir != null) FileUtil.rmDir(_backingdir); } catch (IOException e) { log.error(e); } } }
reader.decZoieRef(); if (writeReader!=null){ try{
public void markDeletes(LongSet delDocs) throws IOException { if(delDocs != null && delDocs.size() > 0) { ZoieIndexReader<R> reader = null; synchronized(this) { reader = openIndexReader(); if(reader == null) return; reader.incZoieRef(); reader.markDeletes(delDocs, _delDocs); } reader.decZoieRef(); } }
if (oldReader !=null) ((ZoieIndexReader<?>)oldReader).decZoieRef();//.decRef();
diskIndexReader.decZoieRef();
r.decZoieRef(); log.info("refCount at shutdown: " + r.getRefCount() + " " + r.directory());
_currentReader = reader; if (oldReader != null) ((ZoieIndexReader<?>) oldReader).decZoieRef();// .decRef();
/** * Clean up */ public void close(){ Mem<R> mem = _mem; if (mem.get_memIndexA()!=null) { mem.get_memIndexA().close(); } if (mem.get_memIndexB()!=null) { mem.get_memIndexB().close(); } if (mem.get_diskIndexReader()!=null) { // try // { mem.get_diskIndexReader().decZoieRef();//.decRef(); _diskIndex.close(); // } // catch (IOException e) // { // log.error("error closing remaining diskReader pooled in mem: " + e); // } } }