Package org.apache.sling.event.impl.jobs
Class JobImpl
- java.lang.Object
-
- org.apache.sling.event.impl.jobs.JobImpl
-
- All Implemented Interfaces:
Comparable<JobImpl>
,org.apache.sling.event.jobs.Job
public class JobImpl extends Object implements org.apache.sling.event.jobs.Job, Comparable<JobImpl>
This object encapsulates all information about a job.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JobImpl.ReadErrorType
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_DELAY_OVERRIDE
Internal job property containing optional delay override.static String
PROPERTY_FINISHED_STATE
This property contains the finished state of a job once it's marked as finished.static String
PROPERTY_JOB_QUEUED
Internal job property specifying when the job was put into the queue.static String
PROPERTY_RESOURCE_PATH
Internal job property containing the resource path.-
Fields inherited from interface org.apache.sling.event.jobs.Job
PROPERTY_FINISHED_DATE, PROPERTY_JOB_CREATED, PROPERTY_JOB_CREATED_INSTANCE, PROPERTY_JOB_DESCRIPTION, PROPERTY_JOB_PROGRESS_ETA, PROPERTY_JOB_PROGRESS_LOG, PROPERTY_JOB_PROGRESS_STEP, PROPERTY_JOB_PROGRESS_STEPS, PROPERTY_JOB_QUEUE_NAME, PROPERTY_JOB_RETRIES, PROPERTY_JOB_RETRY_COUNT, PROPERTY_JOB_RETRY_DELAY, PROPERTY_JOB_STARTED_TIME, PROPERTY_JOB_TARGET_INSTANCE, PROPERTY_JOB_TITLE, PROPERTY_RESULT_MESSAGE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(JobImpl o)
boolean
equals(Object obj)
Calendar
getCreated()
String
getCreatedInstance()
Calendar
getFinishedDate()
int
getFinishedProgressStep()
String
getId()
org.apache.sling.event.jobs.Job.JobState
getJobState()
int
getNumberOfRetries()
Calendar
getProcessingStarted()
Calendar
getProgressETA()
String[]
getProgressLog()
int
getProgressStepCount()
Map<String,Object>
getProperties()
Get all propertiesObject
getProperty(String name)
<T> T
getProperty(String name, Class<T> type)
<T> T
getProperty(String name, T defaultValue)
Set<String>
getPropertyNames()
String
getQueueName()
JobImpl.ReadErrorType
getReadErrorType()
String
getResourcePath()
Get the full resource path.String
getResultMessage()
int
getRetryCount()
String
getTargetInstance()
String
getTopic()
int
hashCode()
boolean
hasReadErrors()
Did we have read errors?boolean
isReadErrorRecoverable()
Is the error recoverable?String
log(int logMaxCount, String message, Object... args)
String[]
prepare(org.apache.sling.event.jobs.Queue queue)
Prepare a new job executionvoid
retry()
Update the information for a retryString[]
setProgress(int step)
void
setProperty(String name, Object value)
String[]
startProgress(int steps, long eta)
String
toString()
String
update(long eta)
void
updateQueueInfo(org.apache.sling.event.jobs.Queue queue)
Update information about the queue.
-
-
-
Field Detail
-
PROPERTY_RESOURCE_PATH
public static final String PROPERTY_RESOURCE_PATH
Internal job property containing the resource path.- See Also:
- Constant Field Values
-
PROPERTY_DELAY_OVERRIDE
public static final String PROPERTY_DELAY_OVERRIDE
Internal job property containing optional delay override.- See Also:
- Constant Field Values
-
PROPERTY_JOB_QUEUED
public static final String PROPERTY_JOB_QUEUED
Internal job property specifying when the job was put into the queue.- See Also:
- Constant Field Values
-
PROPERTY_FINISHED_STATE
public static final String PROPERTY_FINISHED_STATE
This property contains the finished state of a job once it's marked as finished. The value is either "CANCELLED" or "SUCCEEDED". This property is read-only and can't be specified when the job is created.- See Also:
- Constant Field Values
-
-
Method Detail
-
getResourcePath
public String getResourcePath()
Get the full resource path.
-
hasReadErrors
public boolean hasReadErrors()
Did we have read errors?
-
getReadErrorType
public JobImpl.ReadErrorType getReadErrorType()
-
isReadErrorRecoverable
public boolean isReadErrorRecoverable()
Is the error recoverable?
-
retry
public void retry()
Update the information for a retry
-
getTopic
public String getTopic()
- Specified by:
getTopic
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getTopic()
-
getId
public String getId()
- Specified by:
getId
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getId()
-
getProperty
public Object getProperty(String name)
- Specified by:
getProperty
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getProperty(java.lang.String)
-
getProperty
public <T> T getProperty(String name, Class<T> type)
- Specified by:
getProperty
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getProperty(java.lang.String, java.lang.Class)
-
getProperty
public <T> T getProperty(String name, T defaultValue)
- Specified by:
getProperty
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getProperty(java.lang.String, java.lang.Object)
-
getPropertyNames
public Set<String> getPropertyNames()
- Specified by:
getPropertyNames
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getPropertyNames()
-
getRetryCount
public int getRetryCount()
- Specified by:
getRetryCount
in interfaceorg.apache.sling.event.jobs.Job
-
getNumberOfRetries
public int getNumberOfRetries()
- Specified by:
getNumberOfRetries
in interfaceorg.apache.sling.event.jobs.Job
-
getQueueName
public String getQueueName()
- Specified by:
getQueueName
in interfaceorg.apache.sling.event.jobs.Job
-
getTargetInstance
public String getTargetInstance()
- Specified by:
getTargetInstance
in interfaceorg.apache.sling.event.jobs.Job
-
getProcessingStarted
public Calendar getProcessingStarted()
- Specified by:
getProcessingStarted
in interfaceorg.apache.sling.event.jobs.Job
-
getCreated
public Calendar getCreated()
- Specified by:
getCreated
in interfaceorg.apache.sling.event.jobs.Job
-
getCreatedInstance
public String getCreatedInstance()
- Specified by:
getCreatedInstance
in interfaceorg.apache.sling.event.jobs.Job
-
updateQueueInfo
public void updateQueueInfo(org.apache.sling.event.jobs.Queue queue)
Update information about the queue.
-
prepare
public String[] prepare(org.apache.sling.event.jobs.Queue queue)
Prepare a new job execution
-
startProgress
public String[] startProgress(int steps, long eta)
-
setProgress
public String[] setProgress(int step)
-
update
public String update(long eta)
-
getJobState
public org.apache.sling.event.jobs.Job.JobState getJobState()
- Specified by:
getJobState
in interfaceorg.apache.sling.event.jobs.Job
-
getFinishedDate
public Calendar getFinishedDate()
- Specified by:
getFinishedDate
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getFinishedDate()
-
getResultMessage
public String getResultMessage()
- Specified by:
getResultMessage
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getResultMessage()
-
getProgressLog
public String[] getProgressLog()
- Specified by:
getProgressLog
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getProgressLog()
-
getProgressStepCount
public int getProgressStepCount()
- Specified by:
getProgressStepCount
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getProgressStepCount()
-
getFinishedProgressStep
public int getFinishedProgressStep()
- Specified by:
getFinishedProgressStep
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getFinishedProgressStep()
-
getProgressETA
public Calendar getProgressETA()
- Specified by:
getProgressETA
in interfaceorg.apache.sling.event.jobs.Job
- See Also:
Job.getProgressETA()
-
compareTo
public int compareTo(JobImpl o)
- Specified by:
compareTo
in interfaceComparable<JobImpl>
-
-