com.silverpeas.scheduler.quartz
Class QuartzSchedulerJob

java.lang.Object
  extended by com.silverpeas.scheduler.quartz.QuartzSchedulerJob
All Implemented Interfaces:
ScheduledJob, Serializable

public class QuartzSchedulerJob
extends Object
implements ScheduledJob, Serializable

The QuartzSchedulerJob is, as its name implies, a job that will be scheduled within the Quartz scheduler. For each job to schedule by the Scheduler API, a corresponding QuartzSchedulerJob instance is created and registered into the Quartz scheduler. This instance will wrap the actual job, so that when the Quartz scheduler will fire it, it will delegate the job execution to the wrapped job.

See Also:
Serialized Form

Constructor Summary
protected QuartzSchedulerJob(Job jobToExecute, JobTrigger trigger)
          Constructs a new job for the Quartz scheduler.
protected QuartzSchedulerJob(String name, JobTrigger trigger)
          Constructs a new job for the Quartz scheduler.
 
Method Summary
 void execute(JobExecutionContext context)
          Executes the job with the specified execution context.
 String getName()
          Gets the name under which the job is registered into the scheduler.
 long getNexExecutionTimeInMillis()
          Gets the next time in milliseconds at which the execution of this job will be fired.
 Date getNextExecutionTime()
          Gets the next time at which the execution of this job will be fired.
 SchedulerEventListener getSchedulerEventListener()
          Gets the listener of the scheduler's events mapped with the state of this job execution.
 JobTrigger getTrigger()
          Gets the trigger responsible of firing the execution of this job.
protected  void setNextExecutionTime(Date executionTime)
          Sets the next time at which this job will be executed.
protected  QuartzSchedulerJob withSchedulerEventListener(SchedulerEventListener listener)
          Specifies a scheduler event listener that will recieve all of the events concerning this job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuartzSchedulerJob

protected QuartzSchedulerJob(String name,
                             JobTrigger trigger)
Constructs a new job for the Quartz scheduler.

Parameters:
name - the name of the scheduled job.
trigger - the trigger that will fire it.

QuartzSchedulerJob

protected QuartzSchedulerJob(Job jobToExecute,
                             JobTrigger trigger)
Constructs a new job for the Quartz scheduler.

Parameters:
jobToExecute - the job to execute at trigger firing.
trigger - the trigger that will fire it.
Method Detail

withSchedulerEventListener

protected QuartzSchedulerJob withSchedulerEventListener(SchedulerEventListener listener)
Specifies a scheduler event listener that will recieve all of the events concerning this job.

Parameters:
listener - a scheduler event listener.
Returns:
itself.

getName

public String getName()
Description copied from interface: ScheduledJob
Gets the name under which the job is registered into the scheduler.

Specified by:
getName in interface ScheduledJob
Returns:

getTrigger

public JobTrigger getTrigger()
Description copied from interface: ScheduledJob
Gets the trigger responsible of firing the execution of this job.

Specified by:
getTrigger in interface ScheduledJob
Returns:
the trigger of this job.

getSchedulerEventListener

public SchedulerEventListener getSchedulerEventListener()
Description copied from interface: ScheduledJob
Gets the listener of the scheduler's events mapped with the state of this job execution.

Specified by:
getSchedulerEventListener in interface ScheduledJob
Returns:
a scheduler's events listener registered with this job or null if no schedulers were defined with the job.

execute

public void execute(JobExecutionContext context)
             throws Exception
Description copied from interface: ScheduledJob
Executes the job with the specified execution context. The context carries the information that can be required by the job to fulfill its execution, like the job parameters.

Specified by:
execute in interface ScheduledJob
Parameters:
context - the context under which this job is executed.
Throws:
Exception - if an error occurs during the job execution.

getNextExecutionTime

public Date getNextExecutionTime()
Description copied from interface: ScheduledJob
Gets the next time at which the execution of this job will be fired. The next execution time depends upon the trigger with which it is registered in the scheduler.

Specified by:
getNextExecutionTime in interface ScheduledJob
Returns:
the next time at which this job should be executed.

getNexExecutionTimeInMillis

public long getNexExecutionTimeInMillis()
Description copied from interface: ScheduledJob
Gets the next time in milliseconds at which the execution of this job will be fired. The next execution time depends upon the trigger with which it is registered in the scheduler.

Specified by:
getNexExecutionTimeInMillis in interface ScheduledJob
Returns:
the next time in milliseconds at which this job should be executed.

setNextExecutionTime

protected void setNextExecutionTime(Date executionTime)
Sets the next time at which this job will be executed.

Parameters:
executionTime - the next job execution time.


Copyright © 2016 Silverpeas. All Rights Reserved.