public void processFailure(WriteBatch batch, Throwable throwable) {
boolean isHostUnavailableException = processException(batch.getBatcher(), throwable, batch.getClient().getHost());
if ( isHostUnavailableException == true ) {
try {
logger.warn("Retrying failed batch: {}, results so far: {}, uris: {}",
batch.getJobBatchNumber(), batch.getJobWritesSoFar(),
Stream.of(batch.getItems()).map(event->event.getTargetUri()).collect(Collectors.toList()));
batch.getBatcher().retryWithFailureListeners(batch);
} catch (RuntimeException e) {
logger.error("Exception during retry", e);
processFailure(batch, e);
}
}
}