diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentReportService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentReportService.java index e960ff0a..6ea9278e 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentReportService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GradStudentReportService.java @@ -99,17 +99,17 @@ private List 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> tasks, List result, int numberOfThreads) { + private void processReportGradStudentDataTasksAsync(List> tasks, List result) { if(tasks.isEmpty()) return; List> executionResult; - ExecutorService executorService = Executors.newFixedThreadPool(numberOfThreads); + ExecutorService executorService = Executors.newWorkStealingPool(); try { executionResult = executorService.invokeAll(tasks); for (Future f : executionResult) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java index 786b4141..efe5567a 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java @@ -1022,16 +1022,16 @@ private List processStudentDataList(Page 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> tasks, List result, int totalNumberOfPages) { + private void processUUIDDataTasksAsync(List> tasks, List result) { if(tasks.isEmpty()) return; List> executionResult; - ExecutorService executorService = Executors.newFixedThreadPool(totalNumberOfPages); + ExecutorService executorService = Executors.newWorkStealingPool(); try { executionResult = executorService.invokeAll(tasks); for (Future f : executionResult) {