public class InMemoryJobScheduler extends Object implements JobScheduler
| Constructor and Description |
|---|
InMemoryJobScheduler(String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(JobListener listener)
Add a Job listener which will receive events related to scheduled jobs.
|
List<Job> |
getAllJobs()
Get all the outstanding Jobs
|
List<Job> |
getAllJobs(long start,
long finish)
Get all outstanding jobs due to run between start and finish
|
String |
getName() |
List<Job> |
getNextScheduleJobs()
Get all the jobs scheduled to run next
|
long |
getNextScheduleTime()
Get the next time jobs will be fired
|
int |
hashCode() |
boolean |
isDispatchEnabled() |
boolean |
isStarted() |
void |
remove(long time)
remove all jobs scheduled to run at this time
|
void |
remove(String jobId)
remove a job with the matching jobId
|
void |
removeAllJobs()
remove all the Jobs from the scheduler
|
void |
removeAllJobs(long start,
long finish)
remove all the Jobs from the scheduler that are due between the start and finish times
|
void |
removeListener(JobListener listener)
remove a JobListener that was previously registered.
|
void |
schedule(String jobId,
org.apache.activemq.util.ByteSequence payload,
long delay)
Add a job to be scheduled
|
void |
schedule(String jobId,
org.apache.activemq.util.ByteSequence payload,
String cronEntry)
Add a job to be scheduled
|
void |
schedule(String jobId,
org.apache.activemq.util.ByteSequence payload,
String cronEntry,
long delay,
long period,
int repeat)
Add a job to be scheduled
|
void |
start() |
void |
startDispatching()
Starts dispatch of scheduled Jobs to registered listeners.
|
void |
stop() |
void |
stopDispatching()
Stops dispatching of scheduled Jobs to registered listeners.
|
String |
toString() |
public InMemoryJobScheduler(String name)
public String getName() throws Exception
getName in interface JobSchedulerExceptionpublic boolean isStarted()
public boolean isDispatchEnabled()
public void startDispatching() throws Exception
JobSchedulerstartDispatching in interface JobSchedulerExceptionpublic void stopDispatching() throws Exception
JobSchedulerstopDispatching in interface JobSchedulerExceptionpublic void addListener(JobListener listener) throws Exception
JobScheduleraddListener in interface JobSchedulerlistener - The job listener to add.Exceptionpublic void removeListener(JobListener listener) throws Exception
JobSchedulerremoveListener in interface JobSchedulerlistener - The listener that should be removed from the listener registry.Exceptionpublic void schedule(String jobId, org.apache.activemq.util.ByteSequence payload, long delay) throws Exception
JobSchedulerschedule in interface JobSchedulerjobId - a unique identifier for the jobpayload - the message to be sent when the job is scheduleddelay - the time in milliseconds before the job will be runException - if an error occurs while scheduling the Job.public void schedule(String jobId, org.apache.activemq.util.ByteSequence payload, String cronEntry) throws Exception
JobSchedulerschedule in interface JobSchedulerjobId - a unique identifier for the jobpayload - the message to be sent when the job is scheduledcronEntry - The cron entry to use to schedule this job.Exception - if an error occurs while scheduling the Job.public void schedule(String jobId, org.apache.activemq.util.ByteSequence payload, String cronEntry, long delay, long period, int repeat) throws Exception
JobSchedulerschedule in interface JobSchedulerjobId - a unique identifier for the jobpayload - the message to be sent when the job is scheduledcronEntry - cron entrydelay - time in ms to wait before schedulingperiod - the time in milliseconds between successive executions of the Jobrepeat - the number of times to execute the job - less than 0 will be repeated foreverExceptionpublic void remove(long time) throws Exception
JobSchedulerremove in interface JobSchedulertime - The UTC time to use to remove a batch of scheduled Jobs.Exceptionpublic void remove(String jobId) throws Exception
JobSchedulerremove in interface JobSchedulerjobId - The unique Job Id to search for and remove from the scheduled set of jobs.Exception - if an error occurs while removing the Job.public void removeAllJobs() throws Exception
JobSchedulerremoveAllJobs in interface JobSchedulerExceptionpublic void removeAllJobs(long start, long finish) throws Exception
JobSchedulerremoveAllJobs in interface JobSchedulerstart - time in millisecondsfinish - time in millisecondsExceptionpublic long getNextScheduleTime() throws Exception
JobSchedulergetNextScheduleTime in interface JobSchedulerExceptionpublic List<Job> getNextScheduleJobs() throws Exception
JobSchedulergetNextScheduleJobs in interface JobSchedulerExceptionpublic List<Job> getAllJobs() throws Exception
JobSchedulergetAllJobs in interface JobSchedulerExceptionpublic List<Job> getAllJobs(long start, long finish) throws Exception
JobSchedulergetAllJobs in interface JobSchedulerExceptionCopyright © 2005–2020 The Apache Software Foundation. All rights reserved.