Package org.jobrunr.jobs
Class Job
java.lang.Object
org.jobrunr.jobs.AbstractJob
org.jobrunr.jobs.Job
- All Implemented Interfaces:
Lockable
Defines the job with its JobDetails, History and Job Metadata.
Note: Jobs are managed by JobRunr and may under no circumstances be updated during Job Processing. They may be deleted though.
During Job Processing, JobRunr updates the job every x amount of seconds (where x is the pollIntervalInSeconds and defaults to 15s) to distinguish
running jobs from orphaned jobs (orphaned jobs are jobs that have the state in PROGRESS but are not running anymore due to JVM or container crash).
-
Constructor Summary
ConstructorDescriptionJob
(UUID id, int version, JobDetails jobDetails, List<JobState> jobHistory, ConcurrentMap<String, Object> metadata) Job
(UUID id, JobDetails jobDetails) Job
(UUID id, JobDetails jobDetails, JobState jobState) Job
(JobDetails jobDetails) Job
(JobDetails jobDetails, JobState jobState) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
enqueue()
void
getId()
<T extends JobState>
TgetJobState
(int element) getJobStatesOfType
(Class<T> clazz) getLastJobStateOfType
(Class<T> clazz) getState()
boolean
void
scheduleAt
(Instant instant, String reason) void
setRecurringJobId
(String recurringJobId) void
startProcessingOn
(BackgroundJobServer backgroundJobServer) void
toString()
void
Methods inherited from class org.jobrunr.jobs.AbstractJob
getAmountOfRetries, getJobDetails, getJobName, getJobSignature, getLabels, getVersion, lock, setAmountOfRetries, setJobName, setLabels
-
Constructor Details
-
Job
-
Job
-
Job
-
Job
-
Job
public Job(UUID id, int version, JobDetails jobDetails, List<JobState> jobHistory, ConcurrentMap<String, Object> metadata)
-
-
Method Details
-
getId
- Specified by:
getId
in classAbstractJob
-
setRecurringJobId
-
getRecurringJobId
-
getJobStates
-
getJobStatesOfType
-
getLastJobStateOfType
-
getJobState
-
getJobState
-
getState
-
hasState
-
enqueue
public void enqueue() -
scheduleAt
-
startProcessingOn
-
updateProcessing
public void updateProcessing() -
succeeded
public void succeeded() -
failed
-
delete
-
getCreatedAt
-
getUpdatedAt
-
getMetadata
-
toString
-