|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.sun.slamd.server.Scheduler
This class acts as the job scheduler for the SLAMD server. It allows jobs to be submitted for processing (either immediately or at some point in the future) and handles all of the work necessary to make sure that they get started and stopped properly.
| Field Summary | |
static java.lang.String |
CONFIG_SUBSCRIBER_NAME
The name used to register the logger as a subscriber to the configuration handler. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
Scheduler(SLAMDServer slamdServer)
Creates a new instance of the SLAMD scheduler. |
|
| Method Summary | |
void |
cancelAndDeleteJob(java.lang.String jobID)
Cancels a job that has been submitted and removes it from the SLAMD server entirely. |
Job |
cancelJob(java.lang.String jobID,
boolean waitForStop)
Cancels a job that has been submitted. |
boolean |
cancelOptimizingJob(OptimizingJob optimizingJob)
Cancels any iterations of the specified optimizing job that may be pending or running. |
void |
disableJob(java.lang.String jobID)
Disables a job that is pending execution and updates the job state in the config directory. |
void |
enableJob(java.lang.String jobID)
Enables a job that is currently disabled and updates the job state in the config directory. |
java.lang.String |
generateUniqueID()
Generates a unique ID to use for identifying a job in the scheduler. |
int |
getCancelledJobCount()
Retrieves the number of jobs that have been cancelled since the server started. |
int |
getCompletedJobCount()
Retrieves the number of jobs that have completed running since the server started. |
int |
getCurrentScheduledJobCount()
Retrieves the number of jobs that are currently scheduled (both pending and running). |
Job |
getJob(java.lang.String jobID)
Retreives the requested job from the scheduler. |
Job |
getPendingJob(java.lang.String jobID)
Retrieves the job with the requested ID from the pending jobs queue. |
int |
getPendingJobCount()
Retrieves the number of jobs that are currently pending (waiting to run). |
Job[] |
getPendingJobs()
Retrieves the set of jobs that are currently scheduled for execution but not yet running. |
java.lang.String |
getPendingReason(java.lang.String jobID)
Retrieves information about why the specifiedjob is currently in the pending jobs queue and has not yet started running. |
Job |
getRunningJob(java.lang.String jobID)
Retrieves the job with the requested ID from the running jobs queue. |
int |
getRunningJobCount()
Retrieves the number of jobs that are currently running. |
Job[] |
getRunningJobs()
Retrieves the set of jobs that are currently running. |
java.lang.String |
getSubscriberName()
Retrieves the name that the scheduler uses to subscribe to the configuration handler in order to be notified of configuration changes. |
ParameterList |
getSubscriberParameters()
Retrieves the set of configuration parameters associated with this configuration subscriber. |
int |
getTotalScheduledJobCount()
Retrieves the total number of jobs that have been scheduled since the SLAMD server started. |
boolean |
isJobPending(java.lang.String jobID)
Indicates whether the specified job is currently in the pending queue. |
boolean |
isJobRunning(java.lang.String jobID)
Indicates whether the specified job is currently in the running queue. |
boolean |
isJobScheduled(java.lang.String jobID)
Indicates whether the specified job is currently in either the pending or running queue. |
boolean |
isRunning()
Indicates whether the scheduler is currently running. |
void |
jobDone(Job job)
Updates the scheduler and the configuration to indicate that the job has completed processing. |
void |
pollForNewJobs()
Polls the configuration directory to see if any new jobs have been added outside of the administrative interface. |
void |
refreshSubscriberConfiguration()
Re-reads all configuration information used by the SLAMD scheduler. |
void |
refreshSubscriberConfiguration(java.lang.String parameterName)
Re-reads the configuration information for the specified parameter. |
void |
run()
Handles all of the real work of managing the jobs that have been scheduled, including making sure jobs are started at the appropriate time. |
java.lang.String |
scheduleJob(Job job,
java.lang.String folderName)
Submits a new job for processing and returns the job ID associated with that job. |
void |
scheduleOptimizingJob(OptimizingJob optimizingJob,
java.lang.String folderName)
Submits a new optimizing job for processing. |
void |
startScheduler()
Starts the scheduler so that it can dispatch jobs to clients. |
boolean |
stopRequested()
Indicates whether a request has been made to stop the scheduler. |
void |
stopScheduler()
Stops the scheduler so that it will no longer dispatch new jobs to clients. |
void |
waitForStop()
This method will not return until the scheduler has actually stopped. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String CONFIG_SUBSCRIBER_NAME
| Constructor Detail |
public Scheduler(SLAMDServer slamdServer)
throws SLAMDServerException
slamdServer - The SLAMD server with which this scheduler is
associated.
SLAMDServerException - If a problem occurs while initializing the
scheduler.| Method Detail |
public void startScheduler()
public void stopScheduler()
public void waitForStop()
stopScheduler method to signal the scheduler that it needs to
stop.
public java.lang.String scheduleJob(Job job,
java.lang.String folderName)
throws SLAMDServerException
job - The SLAMD job to be scheduled for processing.folderName - The name of the folder in which the job should be
placed.
SLAMDServerException - If a problem is encountered while scheduling
the job for execution.
public void scheduleOptimizingJob(OptimizingJob optimizingJob,
java.lang.String folderName)
throws SLAMDServerException
optimizingJob - The SLAMD optimizing job to be scheduled for
processing.folderName - The name of the folder in which the optimizing job
should be placed.
SLAMDServerException - If a problem is encountered while scheduling
the job for execution.
public Job cancelJob(java.lang.String jobID,
boolean waitForStop)
jobID - Indicates which job should be stopped.waitForStop - Indicates that if the job is currently running,
whether the scheduler should wait for it to stop
before returning.
null if no
reference to that job could be found.public void cancelAndDeleteJob(java.lang.String jobID)
jobID - Indicates which job should be stopped.public boolean cancelOptimizingJob(OptimizingJob optimizingJob)
optimizingJob - The optimizing job for which to cancel any scheduled
iterations.
true if any iterations were found that are still
running, or false if there were no running iterations
found. Note that this return value only accounts for running jobs
and not pending jobs because it is used by the caller to determine
if it should wait for running jobs to complete.
public void disableJob(java.lang.String jobID)
throws SLAMDServerException
jobID - The job ID of the job to be disabled.
SLAMDServerException - If a problem occurs while trying to disable
the job.
public void enableJob(java.lang.String jobID)
throws SLAMDServerException
jobID - The job ID of the job to be enabled.
SLAMDServerException - If a problem occurs while trying to enable
the job.public void jobDone(Job job)
job - The job that the client has completed processing.
public Job getJob(java.lang.String jobID)
throws SLAMDServerException
jobID - The job ID of the job to be retrieved.
null if no reference to the
specified job could be found.
SLAMDServerException - If there is a problem while retrieving the
specified job.public Job[] getPendingJobs()
public Job getPendingJob(java.lang.String jobID)
null if it does not exist in
the pending jobs queue.public Job[] getRunningJobs()
public Job getRunningJob(java.lang.String jobID)
null if it does not exist in
the running jobs queue.public boolean isJobPending(java.lang.String jobID)
jobID - The ID of the job for which to make the determination.
true if the specified job is in the pending queue, or
false if it is not.public java.lang.String getPendingReason(java.lang.String jobID)
jobID - The job ID of the job for which to make the determination.
null if there is no such job in
the pending jobs queue or if there is no reason that it should
not start running.public boolean isJobRunning(java.lang.String jobID)
jobID - The ID of the job for which to make the determination.
true if the specified job is in the running queue, or
false if it is not.public boolean isJobScheduled(java.lang.String jobID)
jobID - The ID of the job for which to make the determination.
true if the specified job is in either queue, or
false if it is not.public boolean isRunning()
true if the scheduler is running or
false if it is not.public boolean stopRequested()
true if a request has been made to stop the scheduler
false if not.public void run()
run in interface java.lang.Runnablepublic void pollForNewJobs()
public java.lang.String generateUniqueID()
public int getTotalScheduledJobCount()
public int getCurrentScheduledJobCount()
public int getRunningJobCount()
public int getPendingJobCount()
public int getCancelledJobCount()
public int getCompletedJobCount()
public java.lang.String getSubscriberName()
getSubscriberName in interface ConfigSubscriberpublic ParameterList getSubscriberParameters()
getSubscriberParameters in interface ConfigSubscriberpublic void refreshSubscriberConfiguration()
refreshSubscriberConfiguration in interface ConfigSubscriberpublic void refreshSubscriberConfiguration(java.lang.String parameterName)
refreshSubscriberConfiguration in interface ConfigSubscriberparameterName - The name of the parameter to re-read from the
configuration.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||