@Test public void writerIsFlushedIfStrategyRequiresIt() throws InterruptedException, IOException { BlazePool<WriterPoolable> pool = createPool(); WriterPoolable writerPoolable = pool.claim(new Timeout(1, SECONDS)); writerPoolable.getWriter().write("some message"); writerPoolable.release(); verify(writer).flush(); }
@Override public void release() { try { flushStrategy.flush(writer); } catch (IOException ioe) { logger.error("Could not flush writer", ioe); invalidate(); } finally { slot.release(this); } }
WriterPoolable implements Poolable { @Override public void release() { try { flushStrategy.flush(writer); } catch (IOException ioe) { logger.error("Could not flush writer", ioe); invalidate(); } finally { slot.release(this); } } }
WriterPoolable implements Poolable { @Override public void release() { try { flushStrategy.flush(writer); } catch (IOException ioe) { logger.error("Could not flush writer", ioe); invalidate(); } finally { slot.release(this); } } WriterPoolable(@Nonnull Slot slot, @Nonnull Writer writer, @Nonnull FlushStrategy flushStrategy); }
WriterPoolable implements Poolable { @Override public void release() { try { flushStrategy.flush(writer); } catch (IOException ioe) { logger.error("Could not flush writer", ioe); invalidate(); } finally { slot.release(this); } } WriterPoolable(@Nonnull Slot slot, @Nonnull Writer writer, @Nonnull FlushStrategy flushStrategy); @Override void release(); void invalidate(); }
WriterPoolable implements Poolable { @Override public void release() { try { flushStrategy.flush(writer); } catch (IOException ioe) { logger.error("Could not flush writer", ioe); invalidate(); } finally { slot.release(this); } } WriterPoolable(@Nonnull Slot slot, @Nonnull Writer writer, @Nonnull FlushStrategy flushStrategy); @Override void release(); void invalidate();  }