Spring Boot Scheduled Annotation Job Issue

24 views Asked by At

I am using spring boot 2.x with hikari CP as data source and MSSQL as database.There are 4 @scheduled Job which runs at 5 seconds fixed delay. There is one @scheduled Job that Execute one SQL query and get the result by jdbcTemplate.queryForList. Some times this query does not return the response(As per the logs). When i checked the logs, i found no logs printed after query and stuck at jdbcTemplate.queryForList and the thread (suppose scheduled-thread 1) was assigned to this has been assigned to another scheduled Task even this has not been completed. Because of this that scheduled task has not been completed and also this Task is not executing anymore. When i restart the service this job start again. Ideally if query takes long time it should throw some exception like timeout or any other exception so that this job completed and can be started again after 5 second. I am not getting how a thread assigned to some other thread job if assigned task not completed.

Please help me here. Thanks

0

There are 0 answers