|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.sourceforge.java.util.jobs.JobManager
Central IJob execution context which is used to add and
schedule IJobs for execution. Offers the option to register an
IJobListener which is notified whenever the status of an
IJob executed in the JobManager context
changes.
Note: Use shutdown() to safely terminate all running
IJobs.
| Field Summary | |
static long |
DEFAULT_DELAY
The default delay in milliseconds of ScheduledJob
instances if started with a delay.
|
private List |
jobListener
The List of registered IJobListener objects
|
private List |
jobs
The List of managed IJobs |
private Timer |
jobScheduler
The Timer used to schedule IJobs |
private static JobManager |
SINGLETON_INSTANCE
The single unique JobManager instance |
| Constructor Summary | |
private |
JobManager()
Creates a new JobManager instance.
|
| Method Summary | |
void |
addJob(IJob job)
Adds the specified IJob to this JobManager.
|
void |
addJob(IJob job,
IProgressMonitor monitor)
Adds the specified IJob to this JobManager.
|
void |
addJobListener(IJobListener listener)
Adds the specified IJobListener to this
JobManager.
|
protected void |
fireJobDone(IJob job)
Notifies all registered IJobListener that the
specified IJob is done.
|
protected void |
fireJobStarted(IJob job)
Notifies all registered IJobListener that the
specified IJob has been started.
|
protected void |
fireJobStatusChanged(IJob job)
Notifies all registered IJobListener that the
status of the specified IJob changed.
|
static JobManager |
getInstance()
Gets the single unique JobManager instance.
|
void |
removeJobListener(IJobListener listener)
Removes the specified IJobListener from this
JobManager.
|
void |
scheduleJob(IJob job,
IProgressMonitor monitor,
JobExecutionStatus executionStatus)
Schedules the specified IJob according to the settings in
the specified JobExecutionStatus object. |
void |
scheduleJob(IJob job,
IProgressMonitor monitor,
long delay)
Schedules the specified IJob for one time execution after
the specified delay.
|
void |
scheduleJob(IJob job,
JobExecutionStatus executionStatus)
Schedules the specified IJob according to the settings in
the specified JobExecutionStatus object. |
void |
scheduleJob(IJob job,
long delay)
Schedules the specified IJob for one time execution after
the specified delay.
|
void |
shutdown()
Shutdown this JobManager by performing a safe termination
of all currently running IJob instances.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final long DEFAULT_DELAY
The default delay in milliseconds of ScheduledJob
instances if started with a delay.
private static JobManager SINGLETON_INSTANCE
The single unique JobManager instance
private List jobs
The List of managed IJobs
private List jobListener
The List of registered IJobListener objects
private Timer jobScheduler
The Timer used to schedule IJobs
| Constructor Detail |
private JobManager()
Creates a new JobManager instance.
| Method Detail |
public static JobManager getInstance()
Gets the single unique JobManager instance.
JobManager instancepublic void addJob(IJob job)
Adds the specified IJob to this JobManager.
job - the IJob to add
public void addJob(IJob job,
IProgressMonitor monitor)
Adds the specified IJob to this JobManager.
job - the IJob to addmonitor - the IProgressMonitor to use for reporting
the progress of the specified IJob
public void scheduleJob(IJob job,
JobExecutionStatus executionStatus)
Schedules the specified IJob according to the settings in
the specified JobExecutionStatus object. If the schdeduled
next execution time of the specified JobExecutionStatus
object as returned by the
JobExecutionStatus.getNextExecutionTime()
method denotes a Date in the past the job is rescheduled
to first start at System.currentTimeMillis() + the
interval as returned by the
JobExecutionStatus.getPeriod()
method. After that it is executed in regular intervals as returned by the
JobExecutionStatus.getNextExecutionTime()
method.
job - the IJob to scheduleexecutionStatus - the JobExecutionStatus which holds
the execution settings
public void scheduleJob(IJob job,
long delay)
Schedules the specified IJob for one time execution after
the specified delay.
job - the IJob to scheduledelay - a delay in milliseconds to wait before to execute the
specified IJob
public void scheduleJob(IJob job,
IProgressMonitor monitor,
JobExecutionStatus executionStatus)
Schedules the specified IJob according to the settings in
the specified JobExecutionStatus object. If the schdeduled
next execution time of the specified JobExecutionStatus
object as returned by the
JobExecutionStatus.getNextExecutionTime()
method denotes a Date in the past the job is rescheduled
to first start at System.currentTimeMillis() + the
interval as returned by the
JobExecutionStatus.getPeriod()
method. After that it is executed in regular intervals as returned by the
JobExecutionStatus.getNextExecutionTime()
method.
job - the IJob to schedulemonitor - the IProgressMonitor to use for reporting
the progress of the IJobexecutionStatus - the JobExecutionStatus which holds
the execution settings
public void scheduleJob(IJob job,
IProgressMonitor monitor,
long delay)
Schedules the specified IJob for one time execution after
the specified delay.
job - the IJob to schedulemonitor - the IProgressMonitor to use for reporting
the progress of the IJobdelay - a delay in milliseconds to wait before to execute the
specified IJobpublic void shutdown()
Shutdown this JobManager by performing a safe termination
of all currently running IJob instances.
public void addJobListener(IJobListener listener)
Adds the specified IJobListener to this
JobManager.
listener - the IJobListener to addpublic void removeJobListener(IJobListener listener)
Removes the specified IJobListener from this
JobManager.
listener - the IJobListener to removeprotected void fireJobStarted(IJob job)
Notifies all registered IJobListener that the
specified IJob has been started.
job - the IJob that has been startedprotected void fireJobDone(IJob job)
Notifies all registered IJobListener that the
specified IJob is done.
job - the IJob is doneprotected void fireJobStatusChanged(IJob job)
Notifies all registered IJobListener that the
status of the specified IJob changed.
job - the IJob whose status changed
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||