Class JobEntity
java.lang.Object
org.camunda.bpm.engine.impl.persistence.entity.AcquirableJobEntity
org.camunda.bpm.engine.impl.persistence.entity.JobEntity
- All Implemented Interfaces:
Serializable
,DbEntity
,DbEntityLifecycleAware
,HasDbReferences
,HasDbRevision
,Job
- Direct Known Subclasses:
EverLivingJobEntity
,MessageEntity
,TimerEntity
public abstract class JobEntity
extends AcquirableJobEntity
implements Serializable, Job, DbEntity, HasDbRevision, HasDbReferences, DbEntityLifecycleAware
Stub of the common parts of a Job. You will normally work with a subclass of
JobEntity, such as
TimerEntity
or MessageEntity
.- Author:
- Tom Baeyens, Nick Burch, Dave Syer, Frederik Heremans
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected Date
static final int
protected String
protected ByteArrayEntity
protected String
protected String
protected ExecutionEntity
protected String
protected String
protected JobDefinition
protected String
protected String
protected String
protected String
protected long
protected String
protected String
protected int
protected long
protected int
protected String
Fields inherited from class org.camunda.bpm.engine.impl.persistence.entity.AcquirableJobEntity
DEFAULT_EXCLUSIVE, duedate, id, isExclusive, lockExpirationTime, lockOwner, processInstanceId, revision, rootProcessInstanceId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected IncidentContext
void
delete()
void
delete
(boolean incidentResolved) protected void
protected void
protected void
protected void
boolean
void
execute
(CommandContext commandContext) The date/time when this job has been createdScope: PERSISTED referencesReturns the id of the deployment in which context the job was created.protected ByteArrayEntity
Returns the message of the exception that occurred, the last time the job was executed.Returns the specific execution on which the job was created.Returns the id of the activity on which the last exception occurred.The id of theJobDefinition
for this job.protected JobHandler
Returns a representation of the object, as would be stored in the database.long
The job's priority that is a hint to job acquisition.Returns the id of the process definition which created the job.Returns the key of the process definition which created the job.Scope: IN-MEMORY referencesScope: IN-MEMORY referencesint
Returns the number of retries this job has left.long
int
The id of the tenant this job belongs to.abstract String
getType()
void
void
init
(CommandContext commandContext) void
init
(CommandContext commandContext, boolean shouldResetLock, boolean shouldCallDeleteHandler) void
insert()
boolean
boolean
Indicates whether this job is suspended.protected void
postExecute
(CommandContext commandContext) void
postLoad()
protected void
preExecute
(CommandContext commandContext) protected void
removeFailedJobIncident
(boolean incidentResolved) void
void
setActivityId
(String activityId) void
setCreateTime
(Date createTime) void
setDeploymentId
(String deploymentId) void
setExceptionMessage
(String exceptionMessage) void
setExceptionStacktrace
(String exception) void
setExecution
(ExecutionEntity execution) void
setExecutionId
(String executionId) void
setFailedActivityId
(String failedActivityId) void
setJobDefinition
(JobDefinition jobDefinition) void
setJobDefinitionId
(String jobDefinitionId) void
setJobHandlerConfiguration
(JobHandlerConfiguration configuration) void
setJobHandlerConfigurationRaw
(String jobHandlerConfiguration) void
setJobHandlerType
(String jobHandlerType) void
setLastFailureLogId
(String lastFailureLogId) void
setPriority
(long priority) void
setProcessDefinitionId
(String processDefinitionId) void
setProcessDefinitionKey
(String processDefinitionKey) void
setRetries
(int retries) void
setRetriesFromPersistence
(int retries) void
setSequenceCounter
(long sequenceCounter) void
setSuspensionState
(int state) void
setTenantId
(String tenantId) toString()
void
unlock()
Unlock from current lock ownerMethods inherited from class org.camunda.bpm.engine.impl.persistence.entity.AcquirableJobEntity
getDuedate, getId, getLockExpirationTime, getLockOwner, getProcessInstanceId, getRevision, getRevisionNext, getRootProcessInstanceId, hashCode, isExclusive, setDuedate, setExclusive, setId, setLockExpirationTime, setLockOwner, setProcessInstanceId, setRevision, setRootProcessInstanceId
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.camunda.bpm.engine.impl.db.HasDbRevision
getRevision, getRevisionNext, setRevision
Methods inherited from interface org.camunda.bpm.engine.runtime.Job
getDuedate, getId, getProcessInstanceId, getRootProcessInstanceId
-
Field Details
-
DEFAULT_RETRIES
public static final int DEFAULT_RETRIES- See Also:
-
executionId
-
processDefinitionId
-
processDefinitionKey
-
retries
protected int retries -
suspensionState
protected int suspensionState -
jobHandlerType
-
jobHandlerConfiguration
-
exceptionByteArray
-
exceptionByteArrayId
-
exceptionMessage
-
deploymentId
-
jobDefinitionId
-
priority
protected long priority -
tenantId
-
createTime
-
activityId
-
jobDefinition
-
execution
-
sequenceCounter
protected long sequenceCounter -
lastFailureLogId
-
failedActivityId
-
persistedDependentEntities
-
-
Constructor Details
-
JobEntity
public JobEntity()
-
-
Method Details
-
execute
-
preExecute
-
postExecute
-
init
-
init
public void init(CommandContext commandContext, boolean shouldResetLock, boolean shouldCallDeleteHandler) -
insert
public void insert() -
delete
public void delete() -
delete
public void delete(boolean incidentResolved) -
getPersistentState
Description copied from interface:DbEntity
Returns a representation of the object, as would be stored in the database. Used when deciding if updates have occurred to the object or not since it was last loaded.- Specified by:
getPersistentState
in interfaceDbEntity
- Overrides:
getPersistentState
in classAcquirableJobEntity
-
setExecution
-
getSequenceCounter
public long getSequenceCounter() -
setSequenceCounter
public void setSequenceCounter(long sequenceCounter) -
incrementSequenceCounter
public void incrementSequenceCounter() -
getExecutionId
Description copied from interface:Job
Returns the specific execution on which the job was created.- Specified by:
getExecutionId
in interfaceJob
-
setExecutionId
-
getExecution
-
ensureExecutionInitialized
protected void ensureExecutionInitialized() -
getRetries
public int getRetries()Description copied from interface:Job
Returns the number of retries this job has left. Whenever the jobexecutor fails to execute the job, this value is decremented. When it hits zero, the job is supposed to be dead and not retried again (ie a manual retry is required then).- Specified by:
getRetries
in interfaceJob
-
setRetries
public void setRetries(int retries) -
setRetriesFromPersistence
public void setRetriesFromPersistence(int retries) -
createFailedJobIncident
protected void createFailedJobIncident() -
removeFailedJobIncident
protected void removeFailedJobIncident(boolean incidentResolved) -
createIncidentContext
-
getExceptionStacktrace
-
setSuspensionState
public void setSuspensionState(int state) -
getSuspensionState
public int getSuspensionState() -
isSuspended
public boolean isSuspended()Description copied from interface:Job
Indicates whether this job is suspended. If a job is suspended, the job will be not acquired by the job executor.- Specified by:
isSuspended
in interfaceJob
- Returns:
- true if this Job is currently suspended.
-
getProcessDefinitionId
Description copied from interface:Job
Returns the id of the process definition which created the job.- Specified by:
getProcessDefinitionId
in interfaceJob
-
setProcessDefinitionId
-
getProcessDefinitionKey
Description copied from interface:Job
Returns the key of the process definition which created the job.- Specified by:
getProcessDefinitionKey
in interfaceJob
-
setProcessDefinitionKey
-
setExceptionStacktrace
-
getJobHandler
-
getJobHandlerConfiguration
-
setJobHandlerConfiguration
-
getJobHandlerType
-
setJobHandlerType
-
getJobHandlerConfigurationRaw
-
setJobHandlerConfigurationRaw
-
getExceptionMessage
Description copied from interface:Job
Returns the message of the exception that occurred, the last time the job was executed. Returns null when no exception occurred. To get the full exception stacktrace, useManagementService.getJobExceptionStacktrace(String)
- Specified by:
getExceptionMessage
in interfaceJob
-
getJobDefinitionId
Description copied from interface:Job
The id of theJobDefinition
for this job.- Specified by:
getJobDefinitionId
in interfaceJob
-
setJobDefinitionId
-
getJobDefinition
-
setJobDefinition
-
ensureJobDefinitionInitialized
protected void ensureJobDefinitionInitialized() -
setExceptionMessage
-
getExceptionByteArrayId
-
getExceptionByteArray
-
ensureExceptionByteArrayInitialized
protected void ensureExceptionByteArrayInitialized() -
clearFailedJobException
protected void clearFailedJobException() -
getDeploymentId
Description copied from interface:Job
Returns the id of the deployment in which context the job was created.- Specified by:
getDeploymentId
in interfaceJob
-
setDeploymentId
-
isInInconsistentLockState
public boolean isInInconsistentLockState() -
resetLock
public void resetLock() -
getActivityId
-
setActivityId
-
getPriority
public long getPriority()Description copied from interface:Job
The job's priority that is a hint to job acquisition.- Specified by:
getPriority
in interfaceJob
-
setPriority
public void setPriority(long priority) -
getTenantId
Description copied from interface:Job
The id of the tenant this job belongs to. Can benull
if the job belongs to no single tenant.- Specified by:
getTenantId
in interfaceJob
-
setTenantId
-
getCreateTime
Description copied from interface:Job
The date/time when this job has been created- Specified by:
getCreateTime
in interfaceJob
-
setCreateTime
-
ensureActivityIdInitialized
protected void ensureActivityIdInitialized() -
unlock
public void unlock()Unlock from current lock owner -
getType
-
equals
- Overrides:
equals
in classAcquirableJobEntity
-
getReferencedEntityIds
Description copied from interface:HasDbReferences
Scope: IN-MEMORY references
- Specified by:
getReferencedEntityIds
in interfaceHasDbReferences
- Returns:
- the ids of the entities that this entity references. Should only return ids for entities of the same type
-
getReferencedEntitiesIdAndClass
Description copied from interface:HasDbReferences
Scope: IN-MEMORY references
- Specified by:
getReferencedEntitiesIdAndClass
in interfaceHasDbReferences
- Returns:
- a map of the ids and the entities' classes that this entity references. It's used when trying to determine if there was an Optimistic Locking occurrence on an INSERT or UPDATE of an object of this type.
-
getDependentEntities
Description copied from interface:HasDbReferences
Scope: PERSISTED references
- Specified by:
getDependentEntities
in interfaceHasDbReferences
-
postLoad
public void postLoad()- Specified by:
postLoad
in interfaceDbEntityLifecycleAware
-
getLastFailureLogId
-
setLastFailureLogId
-
getFailedActivityId
Description copied from interface:Job
Returns the id of the activity on which the last exception occurred.- Specified by:
getFailedActivityId
in interfaceJob
-
setFailedActivityId
-
toString
- Overrides:
toString
in classAcquirableJobEntity
-