/** * Remove and add should be <b>disjoint</b> * @param remove the zoies to be remove. This has to be disjoint from add. * @param add */ public synchronized void swapArchiveZoies(List<ZoieSystem<R, D>> remove, List<ZoieSystem<R, D>> add) { List<ZoieSystem<R, D>> archives = new LinkedList<ZoieSystem<R, D>>(add); if (!box._archiveZoies.containsAll(remove)) { log.error("swapArchiveZoies: potential sync issue. "); } archives.addAll(box._archiveZoies); archives.removeAll(remove); Box<R, D> newbox = new Box<R, D>(box._archives, archives, box._retiree, box._actives, _decorator); box = newbox; }
public void shutdown() { preshutdown(); while (true) { TimeUnit unit = TimeUnit.SECONDS; long t = 10L; try { if (retireThreadPool.awaitTermination(t, unit)) break; } catch (InterruptedException e) { log.warn("Exception when trying to shutdown. Will retry.", e); } } log.info("shutting down thread pool complete."); log.info("shutting down indices."); box.shutdown(); log.info("shutting down indices complete."); }
/** * Remove and add should be <b>disjoint</b> * @param remove the zoies to be remove. This has to be disjoint from add. * @param add */ public synchronized void swapArchiveZoies(List<ZoieSystem<R, D>> remove, List<ZoieSystem<R, D>> add) { List<ZoieSystem<R, D>> archives = new LinkedList<ZoieSystem<R, D>>(add); if (!box._archiveZoies.containsAll(remove)) { log.error("swapArchiveZoies: potential sync issue. "); } archives.addAll(box._archiveZoies); archives.removeAll(remove); Box<R, D> newbox = new Box<R, D>(box._archives, archives, box._retiree, box._actives, _decorator); box = newbox; }
public void shutdown() { preshutdown(); while (true) { TimeUnit unit = TimeUnit.SECONDS; long t = 10L; try { if (retireThreadPool.awaitTermination(t, unit)) break; } catch (InterruptedException e) { log.warn("Exception when trying to shutdown. Will retry.", e); } } log.info("shutting down thread pool complete."); log.info("shutting down indices."); box.shutdown(); log.info("shutting down indices complete."); }
/** * Remove and add should be <b>disjoint</b> * @param remove the zoies to be remove. This has to be disjoint from add. * @param add */ public synchronized void swapArchiveZoies(List<ZoieSystem<R, D>> remove, List<ZoieSystem<R, D>> add) { List<ZoieSystem<R, D>> archives = new LinkedList<ZoieSystem<R, D>>(add); if (!box._archiveZoies.containsAll(remove)) { log.error("swapArchiveZoies: potential sync issue. "); } archives.addAll(box._archiveZoies); archives.removeAll(remove); Box<R, D> newbox = new Box<R, D>(box._archives, archives, box._retiree, box._actives, _decorator); box = newbox; }
public void shutdown() { preshutdown(); while(true) { TimeUnit unit=TimeUnit.SECONDS; long t=10L; try { if (retireThreadPool.awaitTermination(t, unit)) break; } catch (InterruptedException e) { log.warn("Exception when trying to shutdown. Will retry.", e); } } log.info("shutting down thread pool complete."); log.info("shutting down indices."); box.shutdown(); log.info("shutting down indices complete."); } public synchronized List<ZoieIndexReader<R>> getIndexReaders() throws IOException
/** * @param zoie * @param reader the IndexReader opened on the index the give zoie had written to. */ public synchronized void archive(ZoieSystem<R, D> zoie, ZoieMultiReader<R> reader) { List<ZoieMultiReader<R>> archives = new LinkedList<ZoieMultiReader<R>>(box._archives); List<ZoieSystem<R, D>> archiveZoies = new LinkedList<ZoieSystem<R, D>>(box._archiveZoies); List<ZoieSystem<R, D>> actives = new LinkedList<ZoieSystem<R, D>>(box._actives); List<ZoieSystem<R, D>> retiring = new LinkedList<ZoieSystem<R, D>>(box._retiree); retiring.remove(zoie); if (!_appendOnly) archiveZoies.add(zoie); if (reader != null) { archives.add(reader); } Box<R, D> newbox = new Box<R, D>(archives, archiveZoies, retiring, actives, _decorator); box = newbox; }
/** * @param zoie * @param reader the IndexReader opened on the index the give zoie had written to. */ public synchronized void archive(ZoieSystem<R, D> zoie, ZoieMultiReader<R> reader) { List<ZoieMultiReader<R>> archives = new LinkedList<ZoieMultiReader<R>>(box._archives); List<ZoieSystem<R, D>> archiveZoies = new LinkedList<ZoieSystem<R, D>>(box._archiveZoies); List<ZoieSystem<R, D>> actives = new LinkedList<ZoieSystem<R, D>>(box._actives); List<ZoieSystem<R, D>> retiring = new LinkedList<ZoieSystem<R, D>>(box._retiree); retiring.remove(zoie); if (!_appendOnly) archiveZoies.add(zoie); if (reader != null) { archives.add(reader); } Box<R, D> newbox = new Box<R, D>(archives, archiveZoies, retiring, actives, _decorator); box = newbox; }
/** * @param zoie * @param reader the IndexReader opened on the index the give zoie had written to. */ public synchronized void archive(ZoieSystem<R, D> zoie, ZoieMultiReader<R> reader) { List<ZoieIndexReader<R>> archives = new LinkedList<ZoieIndexReader<R>>(box._archives); List<ZoieSystem<R, D>> archiveZoies = new LinkedList<ZoieSystem<R, D>>(box._archiveZoies); List<ZoieSystem<R, D>> actives = new LinkedList<ZoieSystem<R, D>>(box._actives); List<ZoieSystem<R, D>> retiring = new LinkedList<ZoieSystem<R, D>>(box._retiree); retiring.remove(zoie); if (!_appendOnly) archiveZoies.add(zoie); if (reader != null) { archives.add(reader); } Box<R, D> newbox = new Box<R, D>(archives, archiveZoies, retiring, actives, _decorator); box = newbox; } private synchronized void preshutdown()
/** * The readers removed will also be decZoieRef(). But the readers to be added will NOT get incZoieRef(), * 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<ZoieMultiReader<R>> remove, List<ZoieMultiReader<R>> add) { List<ZoieMultiReader<R>> archives = new LinkedList<ZoieMultiReader<R>>(add); if (!box._archives.containsAll(remove)) { log.error("swapArchives: potential sync issue. "); } archives.addAll(box._archives); archives.removeAll(remove); for (ZoieMultiReader<R> r : remove) { r.decZoieRef(); if (log.isDebugEnabled()) { log.debug("remove time " + r.directory() + " refCount: " + r.getInnerRefCount()); } } Box<R, D> newbox = new Box<R, D>(archives, box._archiveZoies, box._retiree, box._actives, _decorator); box = newbox; }
/** * The readers removed will also be decZoieRef(). But the readers to be added will NOT get incZoieRef(), * 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<ZoieMultiReader<R>> remove, List<ZoieMultiReader<R>> add) { List<ZoieMultiReader<R>> archives = new LinkedList<ZoieMultiReader<R>>(add); if (!box._archives.containsAll(remove)) { log.error("swapArchives: potential sync issue. "); } archives.addAll(box._archives); archives.removeAll(remove); for (ZoieMultiReader<R> r : remove) { r.decZoieRef(); if (log.isDebugEnabled()) { log.debug("remove time " + r.directory() + " refCount: " + r.getInnerRefCount()); } } Box<R, D> newbox = new Box<R, D>(archives, box._archiveZoies, box._retiree, box._actives, _decorator); box = newbox; }
/** * 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 synchronized ZoieSystem<R, D> retireAndNew(final ZoieSystem<R, D> old) { DirectoryManager _dirMgr = _dirMgrFactory.getDirectoryManager(); _dirMgrFactory.clearRecentlyChanged(); ZoieSystem<R, D> newzoie = hg.createZoie(_dirMgr); List<ZoieSystem<R, D>> actives = new LinkedList<ZoieSystem<R, D>>(box._actives); List<ZoieSystem<R, D>> retiring = new LinkedList<ZoieSystem<R, D>>(box._retiree); if (old != null) { actives.remove(old); retiring.add(old); retireThreadPool.execute(new Runnable() { @Override public void run() { if (listener != null) { listener.onRetiredZoie(old); } retire(old); } }); } actives.add(newzoie); Box<R, D> newbox = new Box<R, D>(box._archives, box._archiveZoies, retiring, actives, _decorator); box = newbox; if (listener != null) { listener.onNewZoie(newzoie); } return newzoie; }
public synchronized ZoieSystem<R, D> retireAndNew(final ZoieSystem<R, D> old) { DirectoryManager _dirMgr = _dirMgrFactory.getDirectoryManager(); _dirMgrFactory.clearRecentlyChanged(); ZoieSystem<R, D> newzoie = hg.createZoie(_dirMgr); List<ZoieSystem<R, D>> actives = new LinkedList<ZoieSystem<R, D>>(box._actives); List<ZoieSystem<R, D>> retiring = new LinkedList<ZoieSystem<R, D>>(box._retiree); if (old != null) { actives.remove(old); retiring.add(old); retireThreadPool.execute(new Runnable() { @Override public void run() { if (listener != null) { listener.onRetiredZoie(old); } retire(old); } }); } actives.add(newzoie); Box<R, D> newbox = new Box<R, D>(box._archives, box._archiveZoies, retiring, actives, _decorator); box = newbox; if (listener != null) { listener.onNewZoie(newzoie); } return newzoie; }
Box<R, D> newbox = new Box<R, D>(box._archives, box._archiveZoies, retiring, actives, _decorator); box = newbox; if (listener != null) {
box = new Box<R, D>(initArchives, initArchiveZoies, emptyList, emptyList, _decorator);
box = new Box<R, D>(initArchives, initArchiveZoies, emptyList, emptyList, _decorator);
box = new Box<R, D>(initArchives, initArchiveZoies, emptyList, emptyList, _decorator);