class FailoverHandlerChain implements FailoverHandler {

  @Override
  public <T> Response<T> handle(final Invocation<T> invocation, final Response<T> response) {
    logger.debug("Handle {} with failover handler chain (handlers: {})", response.getError(),
        this.failoverHandlers);
    Response<T> next = response;
    for (final FailoverHandler failoverHandler : this.failoverHandlers) {
      if (null == next.getError()) {
        break;
      }
      logger.trace("Handle with {}", failoverHandler);
      next = failoverHandler.handle(invocation, next);
    }
    return next;
  }

    FailoverHandlerChain(final List<ComparableFailoverHandler> failoverHandlers);

}