|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.sling.event.jobs.JobUtil
public abstract class JobUtil
The Job
class is an utility class for
creating and processing jobs.
Nested Class Summary | |
---|---|
static class |
JobUtil.JobPriority
The priority for jobs. |
Field Summary | |
---|---|
static String |
JOB_ID
This is a unique identifer which can be used to cancel the job. |
static String |
PROPERTY_JOB_CREATED
This property is set by the eventing and contains a calendar object specifying the date and time when this job has been created. |
static String |
PROPERTY_JOB_NAME
The property for the unique event name. |
static String |
PROPERTY_JOB_PARALLEL
The property to set if a job can be run parallel to any other job. |
static String |
PROPERTY_JOB_PRIORITY
This property allows to override the priority for the thread used to start this job. |
static String |
PROPERTY_JOB_QUEUE_NAME
The property to set to put the jobs into a separate job queue. |
static String |
PROPERTY_JOB_QUEUE_ORDERED
If this property is set with any value, the queue processes the jobs in the same order as they have arrived. |
static String |
PROPERTY_JOB_RETRIES
The property for setting the maximum number of retries. |
static String |
PROPERTY_JOB_RETRY_COUNT
The property to track the retry count for jobs. |
static String |
PROPERTY_JOB_RETRY_DELAY
The property to set a retry delay. |
static String |
PROPERTY_JOB_RUN_LOCAL
The property to set if a job should only be run on the same app it has been created. |
static String |
PROPERTY_JOB_TOPIC
The job topic property. |
static String |
PROPERTY_NOTIFICATION_JOB
Property containing the job event. |
static String |
TOPIC_JOB
The topic for jobs. |
static String |
TOPIC_JOB_CANCELLED
Asynchronous notification event when a job is cancelled. |
static String |
TOPIC_JOB_FAILED
Asynchronous notification event when a job failed. |
static String |
TOPIC_JOB_FINISHED
Asynchronous notification event when a job is finished. |
static String |
TOPIC_JOB_STARTED
Asynchronous notification event when a job is started. |
Method Summary | |
---|---|
static boolean |
acknowledgeJob(org.osgi.service.event.Event job)
Send an acknowledge. |
static void |
finishedJob(org.osgi.service.event.Event job)
Notify a finished job. |
static Calendar |
getJobCreated(org.osgi.service.event.Event job)
Get the created calendar object. |
static boolean |
isJobEvent(org.osgi.service.event.Event event)
Is this a job event? |
static void |
processJob(org.osgi.service.event.Event job,
JobProcessor processor)
Process a job in the background and notify its success. |
static boolean |
rescheduleJob(org.osgi.service.event.Event job)
Notify a failed job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_JOB_TOPIC
public static final String PROPERTY_JOB_NAME
public static final String PROPERTY_JOB_PARALLEL
true
and false
- string value true
and false
- integer value higher than 1 - if this is specified jobs are run in
parallel but never more than the specified number.
We might want to use different values in the future for enhanced
parallel job handling.
This value is only used, if PROPERTY_JOB_QUEUE_NAME
is
specified and the referenced queue is not started yet.
public static final String PROPERTY_JOB_RUN_LOCAL
public static final String PROPERTY_JOB_RETRY_COUNT
public static final String PROPERTY_JOB_RETRIES
public static final String PROPERTY_JOB_RETRY_DELAY
public static final String PROPERTY_JOB_QUEUE_NAME
PROPERTY_JOB_PARALLEL
with an integer value higher than 1 can be used to specify the maximum number
of parallel jobs for this queue.
public static final String PROPERTY_JOB_QUEUE_ORDERED
PROPERTY_JOB_QUEUE_NAME
is specified
and the job queue has not been started yet.
public static final String PROPERTY_JOB_PRIORITY
processJob(Event, JobProcessor)
method.
If another way of executing the job is used, it is up to the client to ensure
the job priority.
For possible values see JobUtil.JobPriority
.
public static final String PROPERTY_JOB_CREATED
public static final String TOPIC_JOB
public static final String JOB_ID
public static final String TOPIC_JOB_STARTED
PROPERTY_NOTIFICATION_JOB
contains the job event and the
property EventConstants.TIMESTAMP
contains the
timestamp of the event (as a Long).
public static final String TOPIC_JOB_FINISHED
PROPERTY_NOTIFICATION_JOB
contains the job event and the
property EventConstants.TIMESTAMP
contains the
timestamp of the event (as a Long).
public static final String TOPIC_JOB_FAILED
PROPERTY_NOTIFICATION_JOB
contains the job event and the
property EventConstants.TIMESTAMP
contains the
timestamp of the event (as a Long).
public static final String TOPIC_JOB_CANCELLED
PROPERTY_NOTIFICATION_JOB
contains the job event and the
property EventConstants.TIMESTAMP
contains the
timestamp of the event (as a Long).
public static final String PROPERTY_NOTIFICATION_JOB
Method Detail |
---|
public static boolean isJobEvent(org.osgi.service.event.Event event)
PROPERTY_JOB_TOPIC
property.
event
- The event to check.
true>
if this is a job event.public static boolean acknowledgeJob(org.osgi.service.event.Event job)
false
this means someone else is already
processing this job, and the caller should not process the event anymore.
true
if the acknowledge could be sent
IllegalArgumentException
- If the event is a job event but does not have a notifier context.public static void finishedJob(org.osgi.service.event.Event job)
IllegalArgumentException
- If the event is a job event but does not have a notifier context.public static boolean rescheduleJob(org.osgi.service.event.Event job)
true
if the job has been rescheduled, false
otherwise.
IllegalArgumentException
- If the event is a job event but does not have a notifier context.public static void processJob(org.osgi.service.event.Event job, JobProcessor processor)
IllegalArgumentException
- If the event is a job event but does not have a notifier context.public static Calendar getJobCreated(org.osgi.service.event.Event job)
job
- The job event
null
if this is not a job event.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |