
Package ca.uhn.fhir.jpa.sched
Class BaseSchedulerServiceImpl
- java.lang.Object
-
- ca.uhn.fhir.jpa.sched.BaseSchedulerServiceImpl
-
- All Implemented Interfaces:
ISchedulerService
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
- Direct Known Subclasses:
HapiSchedulerServiceImpl
public abstract class BaseSchedulerServiceImpl extends Object implements ISchedulerService, org.springframework.context.SmartLifecycle
This class provides task scheduling for the entire module using the Quartz library. Inside here, we have two schedulers:- The Local Scheduler handles tasks that need to execute locally. This typically means things that should happen on all nodes in a clustered environment.
- The Cluster Scheduler handles tasks that are distributed and should be handled by only one node in the cluster (assuming a clustered server). If the server is not clustered, this scheduler acts the same way as the local scheduler.
-
-
Field Summary
Fields Modifier and Type Field Description protected AutowiringSpringBeanJobFactory
mySchedulerJobFactory
static String
SCHEDULING_DISABLED
static String
SCHEDULING_DISABLED_EQUALS_TRUE
-
Constructor Summary
Constructors Constructor Description BaseSchedulerServiceImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
create()
Set<org.quartz.JobKey>
getClusteredJobKeysForUnitTest()
protected abstract IHapiScheduler
getClusteredScheduler()
protected abstract IHapiScheduler
getLocalHapiScheduler()
Set<org.quartz.JobKey>
getLocalJobKeysForUnitTest()
int
getPhase()
We defer startup of executing started tasks until we're sure we're ready for it and the startup is completely doneboolean
isClusteredSchedulingEnabled()
boolean
isLocalSchedulingEnabled()
boolean
isRunning()
boolean
isStopping()
void
logStatusForUnitTest()
void
purgeAllScheduledJobsForUnitTest()
void
scheduleClusteredJob(long theIntervalMillis, ScheduledJobDefinition theJobDefinition)
void
scheduleLocalJob(long theIntervalMillis, ScheduledJobDefinition theJobDefinition)
void
setClusteredSchedulingEnabled(boolean theClusteredSchedulingEnabled)
BaseSchedulerServiceImpl
setDefaultGroup(String theDefaultGroup)
void
setLocalSchedulingEnabled(boolean theLocalSchedulingEnabled)
void
start()
void
stop()
-
-
-
Field Detail
-
SCHEDULING_DISABLED
public static final String SCHEDULING_DISABLED
- See Also:
- Constant Field Values
-
SCHEDULING_DISABLED_EQUALS_TRUE
public static final String SCHEDULING_DISABLED_EQUALS_TRUE
- See Also:
- Constant Field Values
-
mySchedulerJobFactory
@Autowired protected AutowiringSpringBeanJobFactory mySchedulerJobFactory
-
-
Constructor Detail
-
BaseSchedulerServiceImpl
public BaseSchedulerServiceImpl()
-
-
Method Detail
-
setDefaultGroup
public BaseSchedulerServiceImpl setDefaultGroup(String theDefaultGroup)
-
isLocalSchedulingEnabled
public boolean isLocalSchedulingEnabled()
-
setLocalSchedulingEnabled
public void setLocalSchedulingEnabled(boolean theLocalSchedulingEnabled)
-
isClusteredSchedulingEnabled
public boolean isClusteredSchedulingEnabled()
-
setClusteredSchedulingEnabled
public void setClusteredSchedulingEnabled(boolean theClusteredSchedulingEnabled)
-
create
@PostConstruct public void create() throws org.quartz.SchedulerException
- Throws:
org.quartz.SchedulerException
-
getLocalHapiScheduler
protected abstract IHapiScheduler getLocalHapiScheduler()
-
getClusteredScheduler
protected abstract IHapiScheduler getClusteredScheduler()
-
getPhase
public int getPhase()
We defer startup of executing started tasks until we're sure we're ready for it and the startup is completely done- Specified by:
getPhase
in interfaceorg.springframework.context.Phased
- Specified by:
getPhase
in interfaceorg.springframework.context.SmartLifecycle
-
start
public void start()
- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()
- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
purgeAllScheduledJobsForUnitTest
public void purgeAllScheduledJobsForUnitTest() throws org.quartz.SchedulerException
- Specified by:
purgeAllScheduledJobsForUnitTest
in interfaceISchedulerService
- Throws:
org.quartz.SchedulerException
-
logStatusForUnitTest
public void logStatusForUnitTest()
- Specified by:
logStatusForUnitTest
in interfaceISchedulerService
-
scheduleLocalJob
public void scheduleLocalJob(long theIntervalMillis, ScheduledJobDefinition theJobDefinition)
- Specified by:
scheduleLocalJob
in interfaceISchedulerService
-
scheduleClusteredJob
public void scheduleClusteredJob(long theIntervalMillis, ScheduledJobDefinition theJobDefinition)
- Specified by:
scheduleClusteredJob
in interfaceISchedulerService
-
getLocalJobKeysForUnitTest
public Set<org.quartz.JobKey> getLocalJobKeysForUnitTest() throws org.quartz.SchedulerException
- Specified by:
getLocalJobKeysForUnitTest
in interfaceISchedulerService
- Throws:
org.quartz.SchedulerException
-
getClusteredJobKeysForUnitTest
public Set<org.quartz.JobKey> getClusteredJobKeysForUnitTest() throws org.quartz.SchedulerException
- Specified by:
getClusteredJobKeysForUnitTest
in interfaceISchedulerService
- Throws:
org.quartz.SchedulerException
-
isStopping
public boolean isStopping()
- Specified by:
isStopping
in interfaceISchedulerService
-
-