Description
Background
In AWS standard service architecture have ELB with several backend nodes. In case of globally load balanced service you will have same in several regions. In case one of the regions has problems in AWS there is an option to fail-over. During fail-over IPs from problematic regions no longer distributed to clients in DNS lookup.
Unfortunately if you are using AHC with connection pooling in case of fail-over requests will continue to be routed to region which has a problem. All request will have 5xx error codes.
Issue
To be able to recover with AHC from such situation is would be great to have a config option not to add such problematic channels back to the pool. So that when new connection required DNS lookup will get healthy region.
For 1.8.x i was able to to do it easily as NettyResponseFuture had a httpResponse object inside
protected final boolean getKeepAlive() {
boolean is5xxError = (httpResponse != null && httpResponse.getStatus().getCode() >= 500);
return keepAlive && !is5xxError;
}
in 1.9.x there was a major change in this area and it is no longer easy to do this change.