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).
-
Field Summary
-
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
enqueue()
getId()
<T extends JobState>
TgetJobState
(int element) getJobStatesOfType
(Class<T> clazz) getLastJobStateOfType
(Class<T> clazz) getState()
This method is only to be called by JobRunr itself.boolean
boolean
static UUID
newUUID()
void
scheduleAt
(Instant instant, String reason) void
setRecurringJobId
(String recurringJobId) void
startProcessingOn
(BackgroundJobServer backgroundJobServer) toString()
Methods inherited from class org.jobrunr.jobs.AbstractJob
getAmountOfRetries, getJobDetails, getJobName, getJobSignature, getLabels, getVersion, lock, setAmountOfRetries, setJobName, setLabels
-
Field Details
-
ALLOWED_SORT_COLUMNS
-
-
Constructor Details
-
Job
-
Job
-
Job
-
Job
-
Job
public Job(UUID id, int version, JobDetails jobDetails, List<JobState> jobHistory, ConcurrentMap<String, Object> metadata)
-
-
Method Details
-
newUUID
-
getId
- Specified by:
getId
in classAbstractJob
-
setRecurringJobId
-
getRecurringJobId
-
getJobStates
-
getJobStatesOfType
-
getLastJobStateOfType
-
getJobState
-
getJobState
-
getState
-
hasState
-
hasStateChange
public boolean hasStateChange() -
getStateChangesForJobFilters
This method is only to be called by JobRunr itself. It may not be called externally as it will break theJobFilters
- Returns:
- all the stateChanges since they were last retrieved.
-
enqueue
public void enqueue() -
scheduleAt
-
startProcessingOn
-
updateProcessing
-
succeeded
-
failed
-
delete
-
getCreatedAt
-
getUpdatedAt
-
getMetadata
-
toString
-