@Test public void close_shouldCloseTheDestination_whenAnExceptionIsThrownWaitingForTheProcessingThreadToFinish() throws Exception { when(processingThread.get()).thenThrow(new InterruptedException()); try { logger.close(); } catch (InterruptedException ignore) {} verify(destination).close(); }
@Override public void close() throws Exception { if (closeable) { try { transferQueue.put(Optional.empty()); processingThread.get(); } finally { destination.close(); } } }
AsyncOpsLogger implements OpsLogger<T> { @Override public void close() throws Exception { if (closeable) { try { transferQueue.put(Optional.empty()); processingThread.get(); } finally { destination.close(); } } } }
AsyncOpsLogger implements OpsLogger<T> { @Override public void close() throws Exception { if (closeable) { try { transferQueue.put(Optional.empty()); processingThread.get(); } finally { destination.close(); } } } AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, AsyncExecutor executor); private  AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, Future<?> processingThread, boolean closeable); }
AsyncOpsLogger implements OpsLogger<T> { @Override public void close() throws Exception { if (closeable) { try { transferQueue.put(Optional.empty()); processingThread.get(); } finally { destination.close(); } } } AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, AsyncExecutor executor); private  AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, Future<?> processingThread, boolean closeable); @Override void log(T message, Object... details); @Override void logThrowable(T message, Throwable cause, Object... details); @Override AsyncOpsLogger<T> with(DiagnosticContextSupplier override); @Override void close(); Clock getClock(); Destination<T> getDestination(); DiagnosticContextSupplier getDiagnosticContextSupplier(); Consumer<Throwable> getErrorHandler(); LinkedTransferQueue<Optional<LogicalLogRecord<T>>> getTransferQueue(); }
AsyncOpsLogger implements OpsLogger<T> { @Override public void close() throws Exception { if (closeable) { try { transferQueue.put(Optional.empty()); processingThread.get(); } finally { destination.close(); } } } AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, AsyncExecutor executor); private  AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, Future<?> processingThread, boolean closeable); @Override void log(T message, Object... details); @Override void logThrowable(T message, Throwable cause, Object... details); @Override AsyncOpsLogger<T> with(DiagnosticContextSupplier override); @Override void close(); Clock getClock(); Destination<T> getDestination(); DiagnosticContextSupplier getDiagnosticContextSupplier(); Consumer<Throwable> getErrorHandler(); LinkedTransferQueue<Optional<LogicalLogRecord<T>>> getTransferQueue();  }