I would like to know if there is way to limit the number of queries executed simultaneously by the cassandra java driver ?
Currently, I execute a lot of queries as follows :
...
PreparedStatement stmt = session.prepare("SELECT * FROM users WHERE id = ?");
BoundStatement boundStatement = new BoundStatement(stmt);
List<ResultSetFuture> futures = Lists.newArrayListWithExpectedSize(list.length);
for(String id : list ) {
futures.add(session.executeAsync(boundStatement.bind(id)));
}
for (ListenableFuture<ResultSet> future : futures) {
ResultSet rs = future.get();
... // do some stuff
}
Unfortunately, this may lead to NoHostAvailableException.
Thanks you.