What is the default scheduler pool size in spring-boot?

前端 未结 5 1076
栀梦
栀梦 2020-12-05 09:53

I\'m using spring-boot and @Scheduled annotation to execute some tasks.

How can I find out what the default pool size of scheduled tasks is

5条回答
  •  抹茶落季
    2020-12-05 10:06

    The default scheduler pool size in spring-boot is only one.

    In org.springframework.scheduling.config.ScheduledTaskRegistrar:

        /**
         * Schedule all registered tasks against the underlying
         * {@linkplain #setTaskScheduler(TaskScheduler) task scheduler}.
         */
        @SuppressWarnings("deprecation")
        protected void scheduleTasks() {
            if (this.taskScheduler == null) {
                this.localExecutor = Executors.newSingleThreadScheduledExecutor();
                this.taskScheduler = new ConcurrentTaskScheduler(this.localExecutor);
            }
            ...
        }
    
    

提交回复
热议问题