Skip to content

Commit

Permalink
GRAD2-2299: removed the multithread runnings as many as the number of…
Browse files Browse the repository at this point in the history
… pages to avoid db connection error.

GRAD2-2299: removed the multithread runnings as many as the number of pages to avoid db connection error.
  • Loading branch information
infstar committed Aug 21, 2023
1 parent 6e217c4 commit a729bcf
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 a729bcf

Please sign in to comment.