@Test public void writerIsPassedToTargetOutputWriter() throws Exception { WriterPoolOutputWriter<WriterBasedOutputWriter> outputWriter = new WriterPoolOutputWriter<>(target, pool, new Timeout(1, SECONDS)); outputWriter.doWrite(dummyServer(), dummyQuery(), dummyResults()); verify(target).write(writerCaptor.capture(), any(Server.class), any(Query.class), any(ImmutableList.class)); assertThat(writerCaptor.getValue()).isSameAs(writer); }
@Override public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { WriterPoolable writerPoolable = claimWriter(); try { target.write(writerPoolable.getWriter(), server, query, results); } catch (IOException ioe) { writerPoolable.invalidate(); throw ioe; } finally { writerPoolable.release(); } }
WriterPoolOutputWriter extends OutputWriterAdapter { @Override public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { WriterPoolable writerPoolable = claimWriter(); try { target.write(writerPoolable.getWriter(), server, query, results); } catch (IOException ioe) { writerPoolable.invalidate(); throw ioe; } finally { writerPoolable.release(); } } }
WriterPoolOutputWriter extends OutputWriterAdapter { @Override public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { WriterPoolable writerPoolable = claimWriter(); try { target.write(writerPoolable.getWriter(), server, query, results); } catch (IOException ioe) { writerPoolable.invalidate(); throw ioe; } finally { writerPoolable.release(); } } WriterPoolOutputWriter(@Nonnull T target, @Nonnull LifecycledPool<? extends WriterPoolable> writerPool, @Nonnull Timeout poolClaimTimeout);  WriterPoolOutputWriter(@Nonnull T target, @Nonnull LifecycledPool<? extends WriterPoolable> writerPool, @Nonnull Timeout poolClaimTimeout, @Nullable int socketTimeoutMs); }
WriterPoolOutputWriter extends OutputWriterAdapter { @Override public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { WriterPoolable writerPoolable = claimWriter(); try { target.write(writerPoolable.getWriter(), server, query, results); } catch (IOException ioe) { writerPoolable.invalidate(); throw ioe; } finally { writerPoolable.release(); } } WriterPoolOutputWriter(@Nonnull T target, @Nonnull LifecycledPool<? extends WriterPoolable> writerPool, @Nonnull Timeout poolClaimTimeout);  WriterPoolOutputWriter(@Nonnull T target, @Nonnull LifecycledPool<? extends WriterPoolable> writerPool, @Nonnull Timeout poolClaimTimeout, @Nullable int socketTimeoutMs); @Override void doWrite(Server server, Query query, Iterable<Result> results); @Override void close(); @VisibleForTesting int getSocketTimeoutMs(); @VisibleForTesting LifecycledPool<? extends WriterPoolable> getWriterPool(); }
WriterPoolOutputWriter extends OutputWriterAdapter { @Override public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { WriterPoolable writerPoolable = claimWriter(); try { target.write(writerPoolable.getWriter(), server, query, results); } catch (IOException ioe) { writerPoolable.invalidate(); throw ioe; } finally { writerPoolable.release(); } } WriterPoolOutputWriter(@Nonnull T target, @Nonnull LifecycledPool<? extends WriterPoolable> writerPool, @Nonnull Timeout poolClaimTimeout);  WriterPoolOutputWriter(@Nonnull T target, @Nonnull LifecycledPool<? extends WriterPoolable> writerPool, @Nonnull Timeout poolClaimTimeout, @Nullable int socketTimeoutMs); @Override void doWrite(Server server, Query query, Iterable<Result> results); @Override void close(); @VisibleForTesting int getSocketTimeoutMs(); @VisibleForTesting LifecycledPool<? extends WriterPoolable> getWriterPool();  }