@Override public long unflushedSize() { return sos.unflushedSize(); }
private void throttle() { int n = 0; while (sos.bufferSize() + sos.unflushedSize() > maxBufferMemory) { try { Thread.sleep(1 << n++); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } }
protected void flushAndWait(FlushCounter handler, SortedOplogSet sos) throws InterruptedException, IOException { sos.flush(null, handler); while (sos.unflushedSize() > 0) { Thread.sleep(1000); } }
protected void validateEmpty(SortedOplogSet sos) throws IOException { assertEquals(0, sos.bufferSize()); assertEquals(0, sos.unflushedSize()); SortedIterator<ByteBuffer> iter = sos.scan(); assertFalse(iter.hasNext()); iter.close(); sos.close(); }