How to make sure that the first iteration is run by One Thread and second iteration by Another Thread.
In the below code snippet, the runQuery method executes a Query and brings the resultSet as output.
I have two such queries and I want to run both in Parallel.
for (int i = 0; i < list.size(); i++) {
String ProcessedRecord = list.get(i);
String app_name = application.get(i);
// ResultSet feedDetails = runQuery(ProcessedRecord,app_name);
try {
System.out.println("Inside try block ... ");
ResultSet feedDetails = dat.runQuery(ProcessedRecord, app_name);
rs_feedDetails.add(feedDetails);
} catch(SQLException e) {
e.printStackTrace();
}
}