@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 > MAX_RR_COUNTER) { roundRobinCounter.set(0); } return new RoundRobinExecuteWithFailover<CL, R>(config, monitor, topology.getAllPools().getPools(), index); } catch (ConnectionException e) { monitor.incOperationFailure(e.getHost(), e); throw e; } } }
@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 > MAX_RR_COUNTER) { roundRobinCounter.set(0); } return new RoundRobinExecuteWithFailover<CL, R>(config, monitor, topology.getAllPools().getPools(), index); } catch (ConnectionException e) { monitor.incOperationFailure(e.getHost(), e); throw e; } } }
monitor.incOperationFailure(e.getHost(), e); throw e;
monitor.incOperationFailure(e.getHost(), e); throw e;
try { informException(ce); monitor.incFailover(ce.getHost(), ce);
try { informException(ce); monitor.incFailover(ce.getHost(), ce);