Class JobRegisterServiceImpl
java.lang.Object
org.apache.fineract.infrastructure.jobs.service.JobRegisterServiceImpl
- All Implemented Interfaces:
EventListener,JobRegisterService,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextClosedEvent>
@Service
public class JobRegisterServiceImpl
extends Object
implements JobRegisterService, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextClosedEvent>
Service class to create and load batch jobs to Scheduler using
SchedulerFactoryBean
,MethodInvokingJobDetailFactoryBean and CronTriggerFactoryBean-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteJob(ScheduledJobDetail scheduledJobDetail, String triggerType, Set<org.apache.fineract.infrastructure.jobs.data.JobParameterDTO> jobParameterDTOSet) voidexecuteJobWithParameters(Long jobId, String jobParametersJson) booleanvoidonApplicationEvent(org.springframework.context.event.ContextClosedEvent event) Need to use ContextClosedEvent instead of ContextStoppedEvent because in case Spring Boot fails to start-up (e.g.voidvoidrescheduleJob(Long jobId) voidrescheduleJob(ScheduledJobDetail scheduledJobDetail) voidscheduleJob(ScheduledJobDetail scheduledJobDetails) voidvoidvoidstopScheduler(String name) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
JobRegisterServiceImpl
public JobRegisterServiceImpl()
-
-
Method Details
-
executeJob
public void executeJob(ScheduledJobDetail scheduledJobDetail, String triggerType, Set<org.apache.fineract.infrastructure.jobs.data.JobParameterDTO> jobParameterDTOSet) -
rescheduleJob
-
pauseScheduler
public void pauseScheduler()- Specified by:
pauseSchedulerin interfaceJobRegisterService
-
startScheduler
public void startScheduler()- Specified by:
startSchedulerin interfaceJobRegisterService
-
rescheduleJob
- Specified by:
rescheduleJobin interfaceJobRegisterService
-
executeJobWithParameters
- Specified by:
executeJobWithParametersin interfaceJobRegisterService
-
isSchedulerRunning
public boolean isSchedulerRunning()- Specified by:
isSchedulerRunningin interfaceJobRegisterService
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextClosedEvent event) Need to use ContextClosedEvent instead of ContextStoppedEvent because in case Spring Boot fails to start-up (e.g. because Tomcat port is already in use) then org.springframework.boot.SpringApplication.run(String...) does a context.close(); and not a context.stop();- Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextClosedEvent>
-
scheduleJob
- Specified by:
scheduleJobin interfaceJobRegisterService
-
stopAllSchedulers
public void stopAllSchedulers()- Specified by:
stopAllSchedulersin interfaceJobRegisterService
-
stopScheduler
- Specified by:
stopSchedulerin interfaceJobRegisterService
-