1

We have implemented a scheduled task in our spring boot application, to read messages from MQ. While debugging in IntelliJ I see that the threads of the task are started and then go into a WAIT state after the task is completed.

Is this normal or should the threads be stopped/destroyed after the task completion? Also, do we have to do it manually or Spring takes care of it (and something in the task code is preventing it)

RaRa
  • 140
  • 7

1 Answers1

0

Spring uses a thread pool to manage the scheduler. From the Spring docs on Scheduling:

If you do not provide a pool-size attribute, the default thread pool has only a single thread. There are no other configuration options for the scheduler.

The threads are "waiting" because they are back in the thread pool. Spring thus takes care of this for us. According to this SO post, you only need to configure the thread pool if you are using more than one Scheduler.

AnonymousAngelo
  • 996
  • 3
  • 15
  • 37