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 asTimerEntityorMessageEntity.- Author:
- Tom Baeyens, Nick Burch, Dave Syer, Frederik Heremans
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected StringactivityIdprotected DatecreateTimestatic intDEFAULT_RETRIESprotected StringdeploymentIdprotected ByteArrayEntityexceptionByteArrayprotected StringexceptionByteArrayIdprotected StringexceptionMessageprotected ExecutionEntityexecutionprotected StringexecutionIdprotected StringfailedActivityIdprotected JobDefinitionjobDefinitionprotected StringjobDefinitionIdprotected StringjobHandlerConfigurationprotected StringjobHandlerTypeprotected StringlastFailureLogIdprotected Map<String,Class>persistedDependentEntitiesprotected longpriorityprotected StringprocessDefinitionIdprotected StringprocessDefinitionKeyprotected intretriesprotected longsequenceCounterprotected intsuspensionStateprotected StringtenantId-
Fields inherited from class org.camunda.bpm.engine.impl.persistence.entity.AcquirableJobEntity
DEFAULT_EXCLUSIVE, duedate, id, isExclusive, lockExpirationTime, lockOwner, processInstanceId, revision
-
-
Constructor Summary
Constructors Constructor Description JobEntity()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidclearFailedJobException()protected voidcreateFailedJobIncident()protected IncidentContextcreateIncidentContext()voiddelete()voiddelete(boolean incidentResolved)protected voidensureActivityIdInitialized()protected voidensureExceptionByteArrayInitialized()protected voidensureExecutionInitialized()protected voidensureJobDefinitionInitialized()booleanequals(Object obj)voidexecute(CommandContext commandContext)StringgetActivityId()DategetCreateTime()The date/time when this job has been createdMap<String,Class>getDependentEntities()Scope: PERSISTED referencesStringgetDeploymentId()Returns the id of the deployment in which context the job was created.protected ByteArrayEntitygetExceptionByteArray()StringgetExceptionByteArrayId()StringgetExceptionMessage()Returns the message of the exception that occurred, the last time the job was executed.StringgetExceptionStacktrace()ExecutionEntitygetExecution()StringgetExecutionId()Returns the specific execution on which the job was created.StringgetFailedActivityId()Returns the id of the activity on which the last exception occurred.JobDefinitiongetJobDefinition()StringgetJobDefinitionId()The id of theJobDefinitionfor this job.protected JobHandlergetJobHandler()JobHandlerConfigurationgetJobHandlerConfiguration()StringgetJobHandlerConfigurationRaw()StringgetJobHandlerType()StringgetLastFailureLogId()ObjectgetPersistentState()Returns a representation of the object, as would be stored in the database.longgetPriority()The job's priority that is a hint to job acquisition.StringgetProcessDefinitionId()Returns the id of the process definition which created the job.StringgetProcessDefinitionKey()Returns the key of the process definition which created the job.Map<String,Class>getReferencedEntitiesIdAndClass()Scope: IN-MEMORY referencesSet<String>getReferencedEntityIds()Scope: IN-MEMORY referencesintgetRetries()Returns the number of retries this job has left.longgetSequenceCounter()intgetSuspensionState()StringgetTenantId()The id of the tenant this job belongs to.abstract StringgetType()voidincrementSequenceCounter()voidinit(CommandContext commandContext)voidinsert()booleanisInInconsistentLockState()booleanisSuspended()Indicates whether this job is suspended.protected voidpostExecute(CommandContext commandContext)voidpostLoad()protected voidpreExecute(CommandContext commandContext)protected voidremoveFailedJobIncident(boolean incidentResolved)voidresetLock()voidsetActivityId(String activityId)voidsetCreateTime(Date createTime)voidsetDeploymentId(String deploymentId)voidsetExceptionMessage(String exceptionMessage)voidsetExceptionStacktrace(String exception)voidsetExecution(ExecutionEntity execution)voidsetExecutionId(String executionId)voidsetFailedActivityId(String failedActivityId)voidsetJobDefinition(JobDefinition jobDefinition)voidsetJobDefinitionId(String jobDefinitionId)voidsetJobHandlerConfiguration(JobHandlerConfiguration configuration)voidsetJobHandlerConfigurationRaw(String jobHandlerConfiguration)voidsetJobHandlerType(String jobHandlerType)voidsetLastFailureLogId(String lastFailureLogId)voidsetPriority(long priority)voidsetProcessDefinitionId(String processDefinitionId)voidsetProcessDefinitionKey(String processDefinitionKey)voidsetRetries(int retries)voidsetRetriesFromPersistence(int retries)voidsetSequenceCounter(long sequenceCounter)voidsetSuspensionState(int state)voidsetTenantId(String tenantId)StringtoString()voidunlock()Unlock from current lock owner-
Methods inherited from class org.camunda.bpm.engine.impl.persistence.entity.AcquirableJobEntity
getDuedate, getId, getLockExpirationTime, getLockOwner, getProcessInstanceId, getRevision, getRevisionNext, hashCode, isExclusive, setDuedate, setExclusive, setId, setLockExpirationTime, setLockOwner, setProcessInstanceId, setRevision
-
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
-
-
-
-
Field Detail
-
DEFAULT_RETRIES
public static final int DEFAULT_RETRIES
- See Also:
- Constant Field Values
-
executionId
protected String executionId
-
processDefinitionId
protected String processDefinitionId
-
processDefinitionKey
protected String processDefinitionKey
-
retries
protected int retries
-
suspensionState
protected int suspensionState
-
jobHandlerType
protected String jobHandlerType
-
jobHandlerConfiguration
protected String jobHandlerConfiguration
-
exceptionByteArray
protected ByteArrayEntity exceptionByteArray
-
exceptionByteArrayId
protected String exceptionByteArrayId
-
exceptionMessage
protected String exceptionMessage
-
deploymentId
protected String deploymentId
-
jobDefinitionId
protected String jobDefinitionId
-
priority
protected long priority
-
tenantId
protected String tenantId
-
createTime
protected Date createTime
-
activityId
protected String activityId
-
jobDefinition
protected JobDefinition jobDefinition
-
execution
protected ExecutionEntity execution
-
sequenceCounter
protected long sequenceCounter
-
lastFailureLogId
protected String lastFailureLogId
-
failedActivityId
protected String failedActivityId
-
-
Method Detail
-
execute
public void execute(CommandContext commandContext)
-
preExecute
protected void preExecute(CommandContext commandContext)
-
postExecute
protected void postExecute(CommandContext commandContext)
-
init
public void init(CommandContext commandContext)
-
insert
public void insert()
-
delete
public void delete()
-
delete
public void delete(boolean incidentResolved)
-
getPersistentState
public Object getPersistentState()
Description copied from interface:DbEntityReturns 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:
getPersistentStatein interfaceDbEntity- Overrides:
getPersistentStatein classAcquirableJobEntity
-
setExecution
public void setExecution(ExecutionEntity execution)
-
getSequenceCounter
public long getSequenceCounter()
-
setSequenceCounter
public void setSequenceCounter(long sequenceCounter)
-
incrementSequenceCounter
public void incrementSequenceCounter()
-
getExecutionId
public String getExecutionId()
Description copied from interface:JobReturns the specific execution on which the job was created.- Specified by:
getExecutionIdin interfaceJob
-
setExecutionId
public void setExecutionId(String executionId)
-
getExecution
public ExecutionEntity getExecution()
-
ensureExecutionInitialized
protected void ensureExecutionInitialized()
-
getRetries
public int getRetries()
Description copied from interface:JobReturns 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:
getRetriesin interfaceJob
-
setRetries
public void setRetries(int retries)
-
setRetriesFromPersistence
public void setRetriesFromPersistence(int retries)
-
createFailedJobIncident
protected void createFailedJobIncident()
-
removeFailedJobIncident
protected void removeFailedJobIncident(boolean incidentResolved)
-
createIncidentContext
protected IncidentContext createIncidentContext()
-
getExceptionStacktrace
public String getExceptionStacktrace()
-
setSuspensionState
public void setSuspensionState(int state)
-
getSuspensionState
public int getSuspensionState()
-
isSuspended
public boolean isSuspended()
Description copied from interface:JobIndicates whether this job is suspended. If a job is suspended, the job will be not acquired by the job executor.- Specified by:
isSuspendedin interfaceJob- Returns:
- true if this Job is currently suspended.
-
getProcessDefinitionId
public String getProcessDefinitionId()
Description copied from interface:JobReturns the id of the process definition which created the job.- Specified by:
getProcessDefinitionIdin interfaceJob
-
setProcessDefinitionId
public void setProcessDefinitionId(String processDefinitionId)
-
getProcessDefinitionKey
public String getProcessDefinitionKey()
Description copied from interface:JobReturns the key of the process definition which created the job.- Specified by:
getProcessDefinitionKeyin interfaceJob
-
setProcessDefinitionKey
public void setProcessDefinitionKey(String processDefinitionKey)
-
setExceptionStacktrace
public void setExceptionStacktrace(String exception)
-
getJobHandler
protected JobHandler getJobHandler()
-
getJobHandlerConfiguration
public JobHandlerConfiguration getJobHandlerConfiguration()
-
setJobHandlerConfiguration
public void setJobHandlerConfiguration(JobHandlerConfiguration configuration)
-
getJobHandlerType
public String getJobHandlerType()
-
setJobHandlerType
public void setJobHandlerType(String jobHandlerType)
-
getJobHandlerConfigurationRaw
public String getJobHandlerConfigurationRaw()
-
setJobHandlerConfigurationRaw
public void setJobHandlerConfigurationRaw(String jobHandlerConfiguration)
-
getExceptionMessage
public String getExceptionMessage()
Description copied from interface:JobReturns 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:
getExceptionMessagein interfaceJob
-
getJobDefinitionId
public String getJobDefinitionId()
Description copied from interface:JobThe id of theJobDefinitionfor this job.- Specified by:
getJobDefinitionIdin interfaceJob
-
setJobDefinitionId
public void setJobDefinitionId(String jobDefinitionId)
-
getJobDefinition
public JobDefinition getJobDefinition()
-
setJobDefinition
public void setJobDefinition(JobDefinition jobDefinition)
-
ensureJobDefinitionInitialized
protected void ensureJobDefinitionInitialized()
-
setExceptionMessage
public void setExceptionMessage(String exceptionMessage)
-
getExceptionByteArrayId
public String getExceptionByteArrayId()
-
getExceptionByteArray
protected ByteArrayEntity getExceptionByteArray()
-
ensureExceptionByteArrayInitialized
protected void ensureExceptionByteArrayInitialized()
-
clearFailedJobException
protected void clearFailedJobException()
-
getDeploymentId
public String getDeploymentId()
Description copied from interface:JobReturns the id of the deployment in which context the job was created.- Specified by:
getDeploymentIdin interfaceJob
-
setDeploymentId
public void setDeploymentId(String deploymentId)
-
isInInconsistentLockState
public boolean isInInconsistentLockState()
-
resetLock
public void resetLock()
-
getActivityId
public String getActivityId()
-
setActivityId
public void setActivityId(String activityId)
-
getPriority
public long getPriority()
Description copied from interface:JobThe job's priority that is a hint to job acquisition.- Specified by:
getPriorityin interfaceJob
-
setPriority
public void setPriority(long priority)
-
getTenantId
public String getTenantId()
Description copied from interface:JobThe id of the tenant this job belongs to. Can benullif the job belongs to no single tenant.- Specified by:
getTenantIdin interfaceJob
-
setTenantId
public void setTenantId(String tenantId)
-
getCreateTime
public Date getCreateTime()
Description copied from interface:JobThe date/time when this job has been created- Specified by:
getCreateTimein interfaceJob
-
setCreateTime
public void setCreateTime(Date createTime)
-
ensureActivityIdInitialized
protected void ensureActivityIdInitialized()
-
unlock
public void unlock()
Unlock from current lock owner
-
getType
public abstract String getType()
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAcquirableJobEntity
-
getReferencedEntityIds
public Set<String> getReferencedEntityIds()
Description copied from interface:HasDbReferencesScope: IN-MEMORY references
- Specified by:
getReferencedEntityIdsin interfaceHasDbReferences- Returns:
- the ids of the entities that this entity references. Should only return ids for entities of the same type
-
getReferencedEntitiesIdAndClass
public Map<String,Class> getReferencedEntitiesIdAndClass()
Description copied from interface:HasDbReferencesScope: IN-MEMORY references
- Specified by:
getReferencedEntitiesIdAndClassin 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
public Map<String,Class> getDependentEntities()
Description copied from interface:HasDbReferencesScope: PERSISTED references
- Specified by:
getDependentEntitiesin interfaceHasDbReferences
-
postLoad
public void postLoad()
- Specified by:
postLoadin interfaceDbEntityLifecycleAware
-
getLastFailureLogId
public String getLastFailureLogId()
-
setLastFailureLogId
public void setLastFailureLogId(String lastFailureLogId)
-
getFailedActivityId
public String getFailedActivityId()
Description copied from interface:JobReturns the id of the activity on which the last exception occurred.- Specified by:
getFailedActivityIdin interfaceJob
-
setFailedActivityId
public void setFailedActivityId(String failedActivityId)
-
toString
public String toString()
- Overrides:
toStringin classAcquirableJobEntity
-
-