@Override public void flushAndClose(EnumMap<Metadata, byte[]> metadata) throws IOException { final AtomicReference<Throwable> err = new AtomicReference<Throwable>(null); flush(metadata, new FlushHandler() { @Override public void complete() { } @Override public void error(Throwable t) { err.set(t); } }); // waits for flush completion close(); Throwable t = err.get(); if (t != null) { throw new IOException(t); } }
public void testCloseInterruptsFlush() throws Exception { FlushCounter handler = new FlushCounter(); SortedOplogSetImpl sos = prepSoplogSet("closeDuringFlush"); sos.testDelayDuringFlush = new CountDownLatch(1); sos.flush(null, handler); sos.close(); assertTrue(sos.isClosed()); assertEquals(1, handler.flushes.get()); }
@Override public void destroy() throws IOException { if (logger.fineEnabled()) { logger.fine("Destroying soplog set"); } long start = factory.getConfiguration().getStatistics().getDestroy().begin(); try { unsetCurrent(); clear(); close(); factory.getConfiguration().getStatistics().getDestroy().end(start); } catch (IOException e) { factory.getConfiguration().getStatistics().getDestroy().error(start); throw (IOException) e.fillInStackTrace(); } }