I have a spring-boot microservice (using mongodb, camel and kafka), whose jvm threads keep rising (and never falling)
As part of processing a large number of messages, I am using a ScheduledExecutorService to schedule tasks to run at variable periods (15 or 30 minutes) in the future to check state at the future time and compare it to the time when the message was first processed (and the ScheduledFuture was created)
I am injecting the ActionExecutor below into another class, which calls its the ActionExecutor's methods by reflection (in case this makes any difference)
My assumption was that after the scheduled run of alerter happened, the thread provided by the ScheduledThreadPool to run the alerter runnable would be disposed of automatically, but is this wrong?
Should I be doing something at the end of the alerter run method to dispose of the ScheduledFuture (alertHandle) and/or stop the thread somehow?
Could this be responsible for the constantly increasing count of threads being generated?
If this does not look like a likely candidate for where the problem may lie, has anyone any ideas on how to track down what might be creating all these threads?