@Override public void run() { List<RAMQueueEntry> entries = new ArrayList<>(); try { while (cacheEnabled && writerEnabled) { try { try { // Blocks entries = getRAMQueueEntries(inputQueue, entries); } catch (InterruptedException ie) { if (!cacheEnabled) break; } doDrain(entries); } catch (Exception ioe) { LOG.error("WriterThread encountered error", ioe); } } } catch (Throwable t) { LOG.warn("Failed doing drain", t); } LOG.info(this.getName() + " exiting, cacheEnabled=" + cacheEnabled); }
private static void doDrainOfOneEntry(final BucketCache bc, final BucketCache.WriterThread wt, final BlockingQueue<RAMQueueEntry> q) throws InterruptedException { List<RAMQueueEntry> rqes = BucketCache.getRAMQueueEntries(q, new ArrayList<>(1)); wt.doDrain(rqes); assertTrue(q.isEmpty()); assertTrue(bc.ramCache.isEmpty()); assertEquals(0, bc.heapSize()); } }
public void run() { List<RAMQueueEntry> entries = new ArrayList<RAMQueueEntry>(); try { while (cacheEnabled && writerEnabled) { try { try { // Blocks entries = getRAMQueueEntries(inputQueue, entries); } catch (InterruptedException ie) { if (!cacheEnabled) break; } doDrain(entries); } catch (Exception ioe) { LOG.error("WriterThread encountered error", ioe); } } } catch (Throwable t) { LOG.warn("Failed doing drain", t); } LOG.info(this.getName() + " exiting, cacheEnabled=" + cacheEnabled); }
private static void doDrainOfOneEntry(final BucketCache bc, final BucketCache.WriterThread wt, final BlockingQueue<RAMQueueEntry> q) throws InterruptedException { List<RAMQueueEntry> rqes = BucketCache.getRAMQueueEntries(q, new ArrayList<>(1)); wt.doDrain(rqes); assertTrue(q.isEmpty()); assertTrue(bc.ramCache.isEmpty()); assertEquals(0, bc.heapSize()); } }