Skip to content

Commit

Permalink
Merge pull request #568 from bcgov/hotfix/GRAD2-2299
Browse files Browse the repository at this point in the history
GRAD2-2299: removed the multithread runnings as many as the number of…
  • Loading branch information
kamal-mohammed authored Aug 21, 2023
2 parents 6e217c4 + a729bcf commit 4530fe4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ private List<ReportGradStudentData> createAndExecuteReportGradStudentDataTasks(S
tasks.add(pageTask);
}

processReportGradStudentDataTasksAsync(tasks, result, totalNumberOfPages);
processReportGradStudentDataTasksAsync(tasks, result);
}
logger.debug("Completed in {} sec, total objects acquired {}", (System.currentTimeMillis() - startTime) / 1000, result.size());
return result;
}

@Generated
private void processReportGradStudentDataTasksAsync(List<Callable<Object>> tasks, List<ReportGradStudentData> result, int numberOfThreads) {
private void processReportGradStudentDataTasksAsync(List<Callable<Object>> tasks, List<ReportGradStudentData> result) {
if(tasks.isEmpty()) return;
List<Future<Object>> executionResult;
ExecutorService executorService = Executors.newFixedThreadPool(numberOfThreads);
ExecutorService executorService = Executors.newWorkStealingPool();
try {
executionResult = executorService.invokeAll(tasks);
for (Future<?> f : executionResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1022,16 +1022,16 @@ private List<UUID> processStudentDataList(Page<UUID> studentGuids) {
tasks.add(pageTask);
}

processUUIDDataTasksAsync(tasks, result, totalNumberOfPages);
processUUIDDataTasksAsync(tasks, result);
}
logger.debug("Completed in {} sec, total objects aquared {}", (System.currentTimeMillis() - startTime) / 1000, result.size());
return result;
}

private void processUUIDDataTasksAsync(List<Callable<Object>> tasks, List<UUID> result, int totalNumberOfPages) {
private void processUUIDDataTasksAsync(List<Callable<Object>> tasks, List<UUID> result) {
if(tasks.isEmpty()) return;
List<Future<Object>> executionResult;
ExecutorService executorService = Executors.newFixedThreadPool(totalNumberOfPages);
ExecutorService executorService = Executors.newWorkStealingPool();
try {
executionResult = executorService.invokeAll(tasks);
for (Future<?> f : executionResult) {
Expand Down

0 comments on commit 4530fe4

Please sign in to comment.