public Iterator<Host> newQueryPlan(String loggedKeyspace, Statement statement) { if (statement instanceof SelectedHostStatement) { List<Host> hosts = Lists.newArrayListWithExpectedSize(1); Host host = ((SelectedHostStatement) statement).getHostCordinator(); hosts.add(host); // _log.debug("Host selected for the query plan: ", host.getAddress()); return hosts.iterator(); } else { // use the RoundRobinPolicy's query plan for any other statement types. return super.newQueryPlan(loggedKeyspace, statement); // throw new UnsupportedOperationException("This load balancing policy is only for running the statements of type 'SelectedHostStatement'."); } } }
public Iterator<Host> newQueryPlan(String loggedKeyspace, Statement statement) { if (statement instanceof SelectedHostStatement) { List<Host> hosts = Lists.newArrayListWithExpectedSize(1); Host host = ((SelectedHostStatement) statement).getHostCordinator(); hosts.add(host); // _log.debug("Host selected for the query plan: ", host.getAddress()); return hosts.iterator(); } else { // use the RoundRobinPolicy's query plan for any other statement types. return super.newQueryPlan(loggedKeyspace, statement); // throw new UnsupportedOperationException("This load balancing policy is only for running the statements of type 'SelectedHostStatement'."); } } }