I am using Jobrunr(4.0.1) free version. we have upgraded our postgres database so it went down for some time and after this jobrunr stop working. Now i have schedule a corn job and checking if BackgroundJobServer is running or not. if not then i am restarting again.
@Scheduled(cron = "0/180 * * ? * *")
@SchedulerLock(
name = "job_lock",
lockAtLeastFor = "30s",
lockAtMostFor = "40s"
)
@Trace(dispatcher=true)
public void restartJobs(){
log.error("in Job Runner");
if(JobRunr.getBackgroundJobServer() != null && !JobRunr.getBackgroundJobServer().isRunning()) {
JobRunr.getBackgroundJobServer().start();
}
it successfully restarted but now it's not triggering the jobs.
pom.xml
<dependency>
<groupId>org.jobrunr</groupId>
<artifactId>jobrunr</artifactId>
<version>4.0.1</version>
</dependency>
I also identified this issue and raised a bug: https://github.com/jobrunr/jobrunr/issues/473, which is solved with version 5.1.4 .
Hope this helps.