tuxdevelop / spring-batch-lightmin

Spring Batch Administration @ Spring Boot Stack
Apache License 2.0
129 stars 44 forks source link

ExtendedMapJobInstanceDao.getJobInstanceCount(..) throws exception, if no job instances were found #9

Closed lthielmann closed 7 years ago

lthielmann commented 7 years ago

When asking for the current count of job instances for a specific job, the method ExtendedMapJobInstanceDao.getJobInstanceCount(..) throws an exception, which is logged on level INFO:

 [org.tuxdevelop.spring.batch.lightmin.service.DefaultJobService] No job instances for job name jobName were found
org.springframework.batch.core.launch.NoSuchJobException: No job instances for job name jobName were found
        at com.oneandone.bs.common.spring.batch.repository.dao.ExtendedMapJobInstanceDao.getJobInstanceCount(ExtendedMapJobInstanceDao.java:117)
        at org.springframework.batch.core.explore.support.SimpleJobExplorer.getJobInstanceCount(SimpleJobExplorer.java:191)
        at org.tuxdevelop.spring.batch.lightmin.service.DefaultJobService.getJobInstanceCount(DefaultJobService.java:46)
        at org.tuxdevelop.spring.batch.lightmin.support.ControllerServiceEntryBean.getJobInfo(ControllerServiceEntryBean.java:165)
        at org.tuxdevelop.spring.batch.lightmin.server.job.EmbeddedJobServerService.getJobInfo(EmbeddedJobServerService.java:35)
        at org.tuxdevelop.spring.batch.lightmin.server.web.JobController.initJobs(JobController.java:45)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

--- omitted for clarity ---

This happens when you have a job, which is running once a month but your cleanup job runs multiple times a day. Our workaround is to set the loglevel for org.tuxdevelop.spring.batch.lightmin.service.DefaultJobService to something >INFO. A better solution would be, if getJobInstanceCount would return 0 instead of throwing an exception if no jobinstances were found.

tuxdevelop commented 7 years ago

I close this issue, because the exception is not thrown by spring batch lightmin.

Best Regards

Marcel