Skip to content

Commit

Permalink
Merge pull request #236 from bcgov/hotfix/GRAD2-2299
Browse files Browse the repository at this point in the history
Hotfix/grad2 2299
  • Loading branch information
kamal-mohammed authored Aug 21, 2023
2 parents f749ae3 + 8d69486 commit 73429f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ protected UUID convertStringToGuid(String studentGuid) {
return new UUID(ByteBuffer.wrap(data, 0, 8).getLong(), ByteBuffer.wrap(data, 8, 8).getLong());
}

protected void processReportGradStudentDataTasksAsync(List<Callable<Object>> tasks, List<ReportGradStudentData> result, int numberOfThreads) {
protected 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 All @@ -73,6 +74,7 @@ protected void processReportGradStudentDataTasksAsync(List<Callable<Object>> tas
}
} catch (InterruptedException | ExecutionException ex) {
logger.error("Multithreading error during the task execution: {}", ex.getLocalizedMessage());
Thread.currentThread().interrupt();
} finally {
executorService.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ private List<ReportGradStudentData> processReportGradStudentDataList(Page<School
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;
Expand Down

0 comments on commit 73429f7

Please sign in to comment.