I am using the Spring Framework and Java 11. Does there exist a mechanism to perform several async tasks (like @Async spring)?
But with cancelation of all tasks on timeout without killing/interrupting threads? I mean something like go-routine context cancelation in go?
Asked
Active
Viewed 110 times
0

greybeard
- 2,249
- 8
- 30
- 66

jerryngton
- 3
- 2
1 Answers
0
I highly recommend you read about: ExecutorService, ScheduledExecutorService and SimplAsyncTaskExecutor to understand the mechanism of task executor.
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ExecutorService.html
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html
It provide few built-in functions to execute the task asych with timeout and cancel policy...
You can refer the answer here how to execute schedule with timeout: https://stackoverflow.com/a/2759040/1439560

Huy Nguyen
- 1,931
- 1
- 11
- 11