After executing query results, we may want to process the results of those queries. This can be done by creating an array of ResultSetFuture and looping through the array and calling future methods to get ResultSet. For the earlier query, you could do something like this:
ArrayList<ResultSetFuture> futures = new ArrayList<ResultSetFuture>();for (int i=0; i< 500; i++) { // 500 inserts at a time futures.add( insertUserData(/*.. User data */ ) );}for (ResultSetFuture future : futures) { // Process future resultsfuture.getUninterruptibly();}
First, we instantiate an empty array called futures to store the ResultSetFuture objects.
In the first loop, we execute the insertUserData() method 500 times and add the result ...