-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #443 from bcgov/feature/GRAD2-2395
GRAD2-2395: task is complete
- Loading branch information
Showing
11 changed files
with
159 additions
and
216 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
api/src/main/java/ca/bc/gov/educ/api/batchgraduation/config/AsyncConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
package ca.bc.gov.educ.api.batchgraduation.config; | ||
|
||
import ca.bc.gov.educ.api.batchgraduation.util.EducGradBatchGraduationApiConstants; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.core.task.SimpleAsyncTaskExecutor; | ||
import org.springframework.core.task.TaskExecutor; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
|
||
@Configuration | ||
@EnableAsync | ||
@Profile("!test") | ||
public class AsyncConfig { | ||
@Bean(name = "asyncExecutor") | ||
public TaskExecutor asyncExecutor(EducGradBatchGraduationApiConstants constants) { | ||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
executor.setCorePoolSize(constants.getNumberOfPartitions()); | ||
executor.setMaxPoolSize(constants.getNumberOfPartitions()); | ||
executor.setThreadNamePrefix("async-"); | ||
executor.initialize(); | ||
return executor; | ||
public TaskExecutor asyncExecutor() { | ||
return new SimpleAsyncTaskExecutor("async-"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.