public interface ScheduledJob
ScheduledJob
is a (periodically or manually triggered) task that can be defined by an Application
.
The job's jobDataMap
can contain any information that the job needs to be executed. For periodical execution,
there are two pre-defined entries for the jobDataMap
:
cronExpression
ScheduledJob
should be executed.
enabled
true
and the cronExpression
property is present (and valid), the ScheduledJob
will
automatically be scheduled when the platform starts.
runOnce
true
, this job will only run once per cluster, i.e. it is not executed on each node, which is the
default behavior.
hardInterruptable
true
, this job can safely be interrupted, e.g when a Site
is being reloaded. This is
achieved by running the job in a separate thread and calling Thread.interrupt()
.
allowConcurrentExecutions
true
, multiple instances of this job can run concurrently (default is false
).
Modifier and Type | Method and Description |
---|---|
void |
execute(Site site,
Application application)
This method actually executes the job.
|
String |
getDescription()
Returns the description for this job.
|
Map<String,Object> |
getJobDataMap()
Returns a
Map containing some data needed the execute the job |
default ScheduledJobResult |
getResult()
This method is called after execution of the job.
|
void |
setDescription(String description)
Sets the description for this job.
|
void |
setJobDataMap(Map<String,Object> map)
Sets the
jobDataMap for this job. |
String getDescription()
void setDescription(String description)
description
- the descriptionMap<String,Object> getJobDataMap()
Map
containing some data needed the execute the jobjobDataMap
void setJobDataMap(Map<String,Object> map)
jobDataMap
for this job.map
- jobDataMap
void execute(Site site, Application application) throws Exception
site
- the Site
to run withinapplication
- the Application
to run withinException
- if any error occurs during job executiondefault ScheduledJobResult getResult()
ScheduledJobResult
Copyright © 2011–2023 aiticon GmbH. All rights reserved.