@Override public void close() throws IOException { if (buf != null) { buf.close(); buf = 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; }
doubleBuf.close(); doubleBuf = null;
@Override public void close() throws IOException { if (buf != null) { buf.close(); buf = null; } }
@Override public void close() throws IOException { if (buf != null) { buf.close(); buf = 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; }
@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 public void close() throws IOException { if (fp == null) { throw new IOException("Trying to use aborted output stream"); } try { // close should have been called after all pending transactions // have been flushed & synced. // if already closed, just skip if (doubleBuf != null) { doubleBuf.close(); } // remove the last INVALID marker from transaction log. if (fc != null && fc.isOpen()) { fc.truncate(fc.position()); fc.close(); } if (fp != null) { fp.close(); } } finally { IOUtils.cleanup(FSNamesystem.LOG, fc, fp); doubleBuf = null; fc = null; fp = null; } }
doubleBuf.close(); doubleBuf = null;
doubleBuf.close(); doubleBuf = null;
@Test public void shouldFailToCloseWhenUnflushed() throws IOException { EditsDoubleBuffer buf = new EditsDoubleBuffer(1024); buf.writeRaw(new byte[1], 0, 1); try { buf.close(); fail("Did not fail to close with unflushed data"); } catch (IOException ioe) { if (!ioe.toString().contains("still to be flushed")) { throw ioe; } } } }