Which executor and scheduler is getting used

194 views Asked by At

I was reading below article to implement executor and scheduler.

http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-enable-annotation-support

Can any one please tell me which executor and scheduler does it use when we specify below xml entry

<task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
<task:executor id="myExecutor" pool-size="5"/>
<task:scheduler id="myScheduler" pool-size="10"/>
2

There are 2 answers

1
Bond - Java Bond On BEST ANSWER

Internally spring uses org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor for namespace of task:executor and org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler for task:scheduler.

Refer respective API docs here and here

7
srinigowda On

specify the package

any classes inside that package which have the annotation @Configuration, @EnableScheduling and method with @Scheduled(cron="") will be scheduled on the mentioned time in the cron expression.