Class Job
- java.lang.Object
-
- org.silverpeas.core.scheduler.Job
-
- Direct Known Subclasses:
ActifyDocumentProcessScheduler.ActifyDocumentImportJob
,DefaultWbeHostManager.WbeCacheCleanerJob
,EmptyJob
,ResizedImageCacheCleaner
public abstract class Job extends Object
A job to schedule at a given moments in time. A job is identified in the scheduler by a name that must be unique.The
Job
can be taken into account by persistent schedulers as it isn't really persisted. Indeed, only the class name of the job is serialized so that it can be constructed each time it is being invoked. Therefore, any change in the execution login of the job will be taken into account. Nevertheless, for doing, the job has to be stateless and non anonymous and it must define a constructor without parameters. However, the job can be also managed by the underlying IoC container. Indeed, when fetching from the persistence context, if such a job is managed by theServiceProvider
, then this is this managed job that will be used; otherwise it will be constructed.Any jobs scheduled by a volatile scheduler aren't constrains by the same limitations that a job scheduled by a persistent scheduler: it can be a stateful or an anonymous job.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
execute(JobExecutionContext context)
Executes the job with the specified execution context.String
getName()
Gets the name under which this job should be scheduled.
-
-
-
Constructor Detail
-
Job
public Job(String name)
Creates a new job with the specified name.- Parameters:
name
- the name under which the job has to be registered in the scheduler.
-
-
Method Detail
-
getName
public final String getName()
Gets the name under which this job should be scheduled.- Returns:
- the job name.
-
execute
public abstract void execute(JobExecutionContext context) throws org.silverpeas.kernel.SilverpeasException
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.- Parameters:
context
- the context under which this job is executed.- Throws:
org.silverpeas.kernel.SilverpeasException
- if an error occurs during the job execution.
-
-