I have this background service, recently added to my stable spring boot application that gets packaged as war and runs under tomcat in prod environment.
@Component
@EnableScheduling
public class MonitoringService {
@Autowired
SomeService someService;
@Scheduled(fixedRate = 15*60*1000, initialDelay=30*1000)
public void runPerodically() {
performChecks();
}
@Bean
public TaskScheduler taskScheduler() {
return new ConcurrentTaskScheduler();
}
}
Since this was added the tomcat seems behaving erratic and stuck at times and always produces thread dump when stopped such as
INFO: Destroying ProtocolHandler ["ajp-bio-0.0.0.0-8083"] 2017-09-06 21:43:54 Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.0-b70 mixed mode):
"DestroyJavaVM" #119 prio=5 os_prio=0 tid=0x00007f3ef4529000 nid=0x6496 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE
"pool-7-thread-1" #67 prio=5 os_prio=0 tid=0x00007f3ea8653800 nid=0x7b28 waiting on condition [0x00007f3e9cf41000]
Are there any known issues with this approach or what is the right way to perform this task,