@SuppressWarnings("unchecked")
  public <R> ExecuteWithFailover<CL, R> newExecuteWithFailover(Operation<CL, R> operation)
      throws ConnectionException {
    try {
      if (operation.getPinnedHost() != null) {
        HostConnectionPool<CL> pool = hosts.get(operation.getPinnedHost());
        if (pool == null) {
          throw new NoAvailableHostsException("Host " + operation.getPinnedHost() + " not active");
        }
        return new RoundRobinExecuteWithFailover<CL, R>(
            config, monitor, Arrays.<HostConnectionPool<CL>>asList(pool), 0);
      }

      int index = roundRobinCounter.incrementAndGet();
      if (index > Integer.MAX_VALUE / 2) {
        roundRobinCounter.set(0);
        index = 0;
      }

      return new RoundRobinExecuteWithFailover<CL, R>(
          config, monitor, topology.getAllPools().getPools(), index);
    } catch (ConnectionException e) {
      monitor.incOperationFailure(e.getHost(), e);
      throw e;
    }
  }