@Override // EditLogOutputStream public void close() throws IOException { // close should have been called after all pending transactions // have been flushed & synced. int size = doubleBuf.countBufferedBytes(); if (size != 0) { throw new IOException("BackupEditStream has " + size + " records still to be flushed and cannot be closed."); } RPC.stopProxy(backupNode); // stop the RPC threads doubleBuf.close(); doubleBuf = null; }
/** * Return the size of the current edit log including buffered data. */ @Override long length() throws IOException { // file size + size of both buffers return fc.size() + doubleBuf.countBufferedBytes(); }
@Override // EditLogOutputStream public void close() throws IOException { // close should have been called after all pending transactions // have been flushed & synced. int size = doubleBuf.countBufferedBytes(); if (size != 0) { throw new IOException("BackupEditStream has " + size + " records still to be flushed and cannot be closed."); } RPC.stopProxy(backupNode); // stop the RPC threads doubleBuf.close(); doubleBuf = null; }
@Override // EditLogOutputStream public void close() throws IOException { // close should have been called after all pending transactions // have been flushed & synced. int size = doubleBuf.countBufferedBytes(); if (size != 0) { throw new IOException("BackupEditStream has " + size + " records still to be flushed and cannot be closed."); } RPC.stopProxy(backupNode); // stop the RPC threads doubleBuf.close(); doubleBuf = null; }
buf.writeRaw(data, 0, data.length); assertEquals("Should count new data correctly", data.length, buf.countBufferedBytes()); data.length, buf.countBufferedBytes()); assertFalse(buf.isFlushed()); assertEquals(data.length, outBuf.getLength()); assertTrue(buf.isFlushed()); assertEquals(0, buf.countBufferedBytes()); data.length, buf.countBufferedBytes()); buf.setReadyToFlush(); buf.flushTo(outBuf); assertEquals(0, buf.countBufferedBytes());