I have this springboot application that heavily uses threads with @Async
annotation, i didn't configure the ThreadPoolTaskExecutor
because from what i think, when the thread, say thread-1
finishes with the task, other task can use back this thread-1
.
But from what i observed from the log, it seems that sometime the thread number goes up to thousands, something like following:
2019-07-09 01:48:59.259 INFO 12592 --- [TaskExecutor-1] .s.d.r.c.TestingService :Something is running.
...... //Other threads running
2019-07-09 09:48:59.259 INFO 12592 --- [TaskExecutor-3432] .s.d.r.c.TestingService :Something is running.
I suspect none of those threads are being reused.
Does it means that those threads before number 3432
not reused? And also consuming the memory?
Updates:
I actually checked the log, for example this thread-255
is completed, but there is no task is scheduled in this thread anymore.
2019-07-08 22:23:37.407 INFO 1 --- [TaskExecutor-255] c.d.v.c.j.impl.LoadSomethingAsync : Something is running