IOTraceMonitor extends IOMonitorAdapter implements Flushable { @Override public void flush() { ioLock.lock(); try { while (!ioEvents.isEmpty()) { traceWriter.writeEntry(Objects.toString(ioEvents.poll())); } traceWriter.flush(); } finally { ioLock.unlock(); } } IOTraceMonitor(@NotNull IOTraceWriter traceWriter, @Nullable String contextSpec);  IOTraceMonitor(@NotNull IOTraceWriter traceWriter); void setContext(@NotNull List<String> context); @Override void afterSegmentRead(@NotNull File file, long msb, long lsb, int length,
                                 long elapsed); @Override void flush();  }
@Test public void testFlush() { TraceWriterAssertion traceWriter = new TraceWriterAssertion(); IOTraceMonitor ioTraceMonitor = new IOTraceMonitor(traceWriter, "foo,bar"); traceWriter.assertNotFlushed(); ioTraceMonitor.flush(); traceWriter.assertFlushed(); }