Package org.apache.activemq.broker.jmx
Class JobSchedulerView
- java.lang.Object
-
- org.apache.activemq.broker.jmx.JobSchedulerView
-
- All Implemented Interfaces:
JobSchedulerViewMBean
public class JobSchedulerView extends Object implements JobSchedulerViewMBean
MBean object that can be used to manage a single instance of a JobScheduler. The object provides methods for querying for jobs and removing some or all of the jobs that are scheduled in the managed store.
-
-
Constructor Summary
Constructors Constructor Description JobSchedulerView(JobScheduler jobScheduler)
Creates a new instance of the JobScheduler management MBean.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TabularData
getAllJobs()
Get all the outstanding Jobs that are scheduled in this scheduler store.TabularData
getAllJobs(String startTime, String finishTime)
Get all outstanding jobs due to run between start and finish time range.int
getDelayedMessageCount()
Get the number of delayed messages.int
getExecutionCount(String jobId)
Gets the number of times a scheduled Job has been executed.TabularData
getNextScheduleJobs()
Get all the jobs scheduled to run next.String
getNextScheduleTime()
Get the next time jobs will be fired from this scheduler store.int
getScheduledMessageCount()
Get the number of messages in the scheduler.void
removeAllJobs()
Remove all the Jobs from the scheduler,void
removeAllJobs(String startTime, String finishTime)
Remove all the Jobs from the scheduler that are due between the start and finish times.void
removeAllJobsAtScheduledTime(String time)
Remove all jobs scheduled to run at this time.void
removeJob(String jobId)
Remove a job with the matching jobId.
-
-
-
Constructor Detail
-
JobSchedulerView
public JobSchedulerView(JobScheduler jobScheduler)
Creates a new instance of the JobScheduler management MBean.- Parameters:
jobScheduler
- The scheduler instance to manage.
-
-
Method Detail
-
getAllJobs
public TabularData getAllJobs() throws Exception
Description copied from interface:JobSchedulerViewMBean
Get all the outstanding Jobs that are scheduled in this scheduler store.- Specified by:
getAllJobs
in interfaceJobSchedulerViewMBean
- Returns:
- a table of all jobs in this scheduler store.
- Throws:
Exception
- if an error occurs while reading the store.
-
getAllJobs
public TabularData getAllJobs(String startTime, String finishTime) throws Exception
Description copied from interface:JobSchedulerViewMBean
Get all outstanding jobs due to run between start and finish time range.- Specified by:
getAllJobs
in interfaceJobSchedulerViewMBean
- Parameters:
startTime
- the starting time range to query the store for jobs.finishTime
- the ending time of this query for scheduled jobs.- Returns:
- a table of jobs in the range given.
- Throws:
Exception
- if an error occurs while querying the scheduler store.
-
getDelayedMessageCount
public int getDelayedMessageCount() throws Exception
Description copied from interface:JobSchedulerViewMBean
Get the number of delayed messages.- Specified by:
getDelayedMessageCount
in interfaceJobSchedulerViewMBean
- Returns:
- the number of delayed messages.
- Throws:
Exception
- if an error occurs while querying the scheduler store.
-
getScheduledMessageCount
public int getScheduledMessageCount() throws Exception
Description copied from interface:JobSchedulerViewMBean
Get the number of messages in the scheduler.- Specified by:
getScheduledMessageCount
in interfaceJobSchedulerViewMBean
- Returns:
- the number of messages in the scheduler.
- Throws:
Exception
- if an error occurs while querying the scheduler store.
-
getNextScheduleJobs
public TabularData getNextScheduleJobs() throws Exception
Description copied from interface:JobSchedulerViewMBean
Get all the jobs scheduled to run next.- Specified by:
getNextScheduleJobs
in interfaceJobSchedulerViewMBean
- Returns:
- a list of jobs that will be scheduled next
- Throws:
Exception
- if an error occurs while reading the scheduler store.
-
getNextScheduleTime
public String getNextScheduleTime() throws Exception
Description copied from interface:JobSchedulerViewMBean
Get the next time jobs will be fired from this scheduler store.- Specified by:
getNextScheduleTime
in interfaceJobSchedulerViewMBean
- Returns:
- the time in milliseconds of the next job to execute.
- Throws:
Exception
- if an error occurs while accessing the store.
-
removeAllJobs
public void removeAllJobs() throws Exception
Description copied from interface:JobSchedulerViewMBean
Remove all the Jobs from the scheduler,- Specified by:
removeAllJobs
in interfaceJobSchedulerViewMBean
- Throws:
Exception
- if an error occurs while purging the store.
-
removeAllJobs
public void removeAllJobs(String startTime, String finishTime) throws Exception
Description copied from interface:JobSchedulerViewMBean
Remove all the Jobs from the scheduler that are due between the start and finish times.- Specified by:
removeAllJobs
in interfaceJobSchedulerViewMBean
- Parameters:
startTime
- the starting time to remove jobs from.finishTime
- the finish time for the remove operation.- Throws:
Exception
- if an error occurs while attempting to remove the jobs.
-
removeAllJobsAtScheduledTime
public void removeAllJobsAtScheduledTime(String time) throws Exception
Description copied from interface:JobSchedulerViewMBean
Remove all jobs scheduled to run at this time. If there are no jobs scheduled at the given time this methods returns without making any modifications to the scheduler store.- Specified by:
removeAllJobsAtScheduledTime
in interfaceJobSchedulerViewMBean
- Parameters:
time
- the string formated time that should be used to remove jobs.- Throws:
Exception
- if an error occurs while performing the remove.
-
removeJob
public void removeJob(String jobId) throws Exception
Description copied from interface:JobSchedulerViewMBean
Remove a job with the matching jobId. If the method does not find a matching job then it returns without throwing an error or making any modifications to the job scheduler store.- Specified by:
removeJob
in interfaceJobSchedulerViewMBean
- Parameters:
jobId
- the Job Id to remove from the scheduler store.- Throws:
Exception
- if an error occurs while attempting to remove the Job.
-
getExecutionCount
public int getExecutionCount(String jobId) throws Exception
Description copied from interface:JobSchedulerViewMBean
Gets the number of times a scheduled Job has been executed.- Specified by:
getExecutionCount
in interfaceJobSchedulerViewMBean
- Returns:
- the total number of time a scheduled job has executed.
- Throws:
Exception
- if an error occurs while querying for the Job.
-
-