You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide properties to set the number of threads of spring TaskScheduler #1397
By default, it use Executors.newSingleThreadScheduledExecutor() to create executor, and it only have one thread.
But when I config the executor manually:
@Bean
public ConcurrentTaskScheduler taskScheduler() {
ConcurrentTaskScheduler taskScheduler = new ConcurrentTaskScheduler();
taskScheduler.setScheduledExecutor(executorService());
return taskScheduler;
}
@Bean
public ScheduledExecutorService executorService() {
ScheduledExecutorFactoryBean bean = new ScheduledExecutorFactoryBean();
bean.setThreadNamePrefix("schedule");
bean.setPoolSize(10);
return bean.getObject();
}
Exception occurs:
Exception in thread "main" java.lang.IllegalStateException: More than one TaskScheduler and/or ScheduledExecutorService exist within the context.
changed the title [-]Is there any way to set the number of threads of spring TaskScheduler?[/-][+]Is there any convenient way to set the number of threads of spring TaskScheduler?[/+]on Aug 19, 2014
There is no explicit scheduling support in Spring boot if that's what your question is. Are you saying we should provide an easier way to configure the executor service used by @EnableScheduling?
Reacted by Nikita Salnikov-Tarnovski, Shankar and Guy Klebanov
changed the title [-]Is there any convenient way to set the number of threads of spring TaskScheduler?[/-][+]Provide properties to set the number of threads of spring TaskScheduler[/+]on Aug 21, 2014
Activity
[-]Is there any way to set the number of threads of spring TaskScheduler?[/-][+]Is there any convenient way to set the number of threads of spring TaskScheduler?[/+]m11y commentedon Aug 19, 2014
When I config as follow:
It, works.
However, is there any convenient way to config executor pool size. like:
to config:
snicoll commentedon Aug 19, 2014
There is no explicit scheduling support in Spring boot if that's what your question is. Are you saying we should provide an easier way to configure the executor service used by
@EnableScheduling?m11y commentedon Aug 19, 2014
@snicoll yes, my English is very poor.
[-]Is there any convenient way to set the number of threads of spring TaskScheduler?[/-][+]Provide properties to set the number of threads of spring TaskScheduler[/+]philwebb commentedon Mar 22, 2018
Duplicates #1563.
snicoll commentedon Aug 6, 2018
That's not a duplicate of #1563 - #1563 is about
TaskExecutorand this one is aboutTaskScheduler. Those are two completely separate contracts.Hacking
Remove extraneous asterisk