public abstract class ERQSSchedulerServiceFrameworkPrincipal extends ERXFrameworkPrincipal
getListOfJobDescription
,
implement the methods newEditingContext(), newEditingContext(osc) and that's it!Don't forget to include the following static code in your class:
static { log.debug("MyClassThatExtendsCOSchedulerServiceFrameworkPrincipal: static: ENTERED"); setUpFrameworkPrincipalClass(MyClassThatExtendsCOSchedulerServiceFrameworkPrincipal.class); log.debug("MyClassThatExtendsCOSchedulerServiceFrameworkPrincipal: static: DONE"); }
ERXFrameworkPrincipal.Observer
Modifier and Type | Field and Description |
---|---|
static String |
INSTANCE_KEY |
initializedFrameworks, launchingFrameworks
Constructor and Description |
---|
ERQSSchedulerServiceFrameworkPrincipal() |
Modifier and Type | Method and Description |
---|---|
protected void |
addJobListener(org.quartz.JobListener newJobListener)
Use this method if you need to add other listeners jobs handled by COScheduler, aka job with group
beginning with ERQSJobSupervisor.GROUP_NAME_PREFIX
|
void |
deleteAllJobs() |
void |
finishInitialization()
This method initializes the scheduler service.
|
List<org.quartz.JobDetail> |
getAllJobs()
Return a list of all jobs handled by the scheduler, even those that are not managed by the framework, aka
jobs that have been added manually.
|
protected org.quartz.JobListener |
getDefaultJobListener()
This method returns a joblistener object.
|
abstract NSArray<? extends ERQSJobDescription> |
getListOfJobDescription(EOEditingContext editingContext)
Expects that this method never returns null but an empty array if there is no job
|
org.quartz.Scheduler |
getScheduler()
Return the quartz scheduler which schedules the job described by ERQSJobDescription objects.
|
static ERQSSchedulerServiceFrameworkPrincipal |
getSharedInstance() |
org.quartz.Trigger |
getTriggerOfJob(org.quartz.JobKey aJobKey) |
org.quartz.Trigger.TriggerState |
getTriggerState(org.quartz.JobKey aJobKey) |
boolean |
hasRunningJobs() |
protected void |
instantiateJobSupervisor() |
abstract EOEditingContext |
newEditingContext()
This method is used by a job that subclasses ERQSAbstractJob.
|
abstract EOEditingContext |
newEditingContext(EOObjectStore parent)
This method is used by a job that subclasses ERQSAbstractJob.
|
static boolean |
schedulerMustRun()
This method reads the the property er.quartzscheduler.schedulerServiceToLaunch
|
static void |
setSharedInstance(ERQSSchedulerServiceFrameworkPrincipal aSharedInstance) |
void |
stopScheduler() |
protected int |
supervisorSleepDuration() |
void |
triggerNow(org.quartz.JobDetail aJob) |
didFinishInitialization, hasFrameworkInstalled, initialize, setUpFrameworkPrincipalClass, sharedInstance, toString
public static final String INSTANCE_KEY
public ERQSSchedulerServiceFrameworkPrincipal()
public static ERQSSchedulerServiceFrameworkPrincipal getSharedInstance()
public static void setSharedInstance(ERQSSchedulerServiceFrameworkPrincipal aSharedInstance)
public abstract NSArray<? extends ERQSJobDescription> getListOfJobDescription(EOEditingContext editingContext)
public abstract EOEditingContext newEditingContext()
private static ERXEC.Factory manualLockingEditingContextFactory = new ERXEC.DefaultFactory() { protected EOEditingContext _createEditingContext(final EOObjectStore parent) { return new MyEditingContext(parent == null ? EOEditingContext.defaultParentObjectStore() : parent) { public boolean useAutoLock() {return false;} public boolean coalesceAutoLocks() {return false;} }; }Then implement newEditingContext() as follow:
public EOEditingContext newEditingContext() { EOObjectStoreCoordinator osc = ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator(); return COEditingContextFactory.newManualLockingEditingContext(osc); }
public abstract EOEditingContext newEditingContext(EOObjectStore parent)
public void finishInitialization()
The following services must be set:
true
any new job/trigger will be
in pause mode when added to the scheduler. Very useful when you are developing and debugging your code.
finishInitialization
in class ERXFrameworkPrincipal
public static boolean schedulerMustRun()
It's a static method because the sharedInstance could be null if it's not running.
true
if the scheduler should run, false
by default.public org.quartz.Scheduler getScheduler()
As the quartz scheduler is uses a ram job stores, everything is gone when the scheduler stops.
The persistence must be handled by your own EOs which must implement ERQSJobDescription interface.
You have several options to set quartz properties:
ERQSJobDescription
public List<org.quartz.JobDetail> getAllJobs()
public boolean hasRunningJobs()
public org.quartz.Trigger.TriggerState getTriggerState(org.quartz.JobKey aJobKey)
public org.quartz.Trigger getTriggerOfJob(org.quartz.JobKey aJobKey)
public void triggerNow(org.quartz.JobDetail aJob) throws org.quartz.SchedulerException
org.quartz.SchedulerException
protected void instantiateJobSupervisor()
protected void addJobListener(org.quartz.JobListener newJobListener)
newJobListener
- protected org.quartz.JobListener getDefaultJobListener()
protected int supervisorSleepDuration()
public void deleteAllJobs()
public void stopScheduler()
Copyright © 2002 – 2024 Project Wonder.