UndertowLogger.PROXY_REQUEST_LOGGER.proxyRequestFailed(exchange.getRequestURI(), e);
if(idempotentPredicate.resolve(exchange) && proxyClientHandler != null) {
</BUG>
proxyClientHandler.failed(exchange); //this will attempt a retry if configured to do so
} else {
<BUG>if (!exchange.isResponseStarted()) {</BUG>
exchange.setStatusCode(StatusCodes.SERVICE_UNAVAILABLE);
exchange.endExchange();
<BUG>} else {
IoUtils.safeClose(exchange.getConnection());
}
}
}
});</BUG>
}

UndertowLogger.PROXY_REQUEST_LOGGER.proxyRequestFailed(exchange.getRequestURI(), e);
if(exchange.isResponseStarted()) {
IoUtils.safeClose(exchange.getConnection());
} else if(idempotentRequestPredicate.resolve(exchange) && proxyClientHandler != null) {
proxyClientHandler.failed(exchange); //this will attempt a retry if configured to do so
} else {
exchange.setStatusCode(StatusCodes.SERVICE_UNAVAILABLE);
exchange.endExchange();
