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 asTimerEntity
orMessageEntity
.- Author:
- Tom Baeyens, Nick Burch, Dave Syer, Frederik Heremans
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
activityId
protected Date
createTime
static int
DEFAULT_RETRIES
protected String
deploymentId
protected ByteArrayEntity
exceptionByteArray
protected String
exceptionByteArrayId
protected String
exceptionMessage
protected ExecutionEntity
execution
protected String
executionId
protected String
failedActivityId
protected JobDefinition
jobDefinition
protected String
jobDefinitionId
protected String
jobHandlerConfiguration
protected String
jobHandlerType
protected String
lastFailureLogId
protected Map<String,Class>
persistedDependentEntities
protected long
priority
protected String
processDefinitionId
protected String
processDefinitionKey
protected int
retries
protected long
sequenceCounter
protected int
suspensionState
protected String
tenantId
-
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 void
clearFailedJobException()
protected void
createFailedJobIncident()
protected IncidentContext
createIncidentContext()
void
delete()
void
delete(boolean incidentResolved)
protected void
ensureActivityIdInitialized()
protected void
ensureExceptionByteArrayInitialized()
protected void
ensureExecutionInitialized()
protected void
ensureJobDefinitionInitialized()
boolean
equals(Object obj)
void
execute(CommandContext commandContext)
String
getActivityId()
Date
getCreateTime()
The date/time when this job has been createdMap<String,Class>
getDependentEntities()
Scope: PERSISTED referencesString
getDeploymentId()
Returns the id of the deployment in which context the job was created.protected ByteArrayEntity
getExceptionByteArray()
String
getExceptionByteArrayId()
String
getExceptionMessage()
Returns the message of the exception that occurred, the last time the job was executed.String
getExceptionStacktrace()
ExecutionEntity
getExecution()
String
getExecutionId()
Returns the specific execution on which the job was created.String
getFailedActivityId()
Returns the id of the activity on which the last exception occurred.JobDefinition
getJobDefinition()
String
getJobDefinitionId()
The id of theJobDefinition
for this job.protected JobHandler
getJobHandler()
JobHandlerConfiguration
getJobHandlerConfiguration()
String
getJobHandlerConfigurationRaw()
String
getJobHandlerType()
String
getLastFailureLogId()
Object
getPersistentState()
Returns a representation of the object, as would be stored in the database.long
getPriority()
The job's priority that is a hint to job acquisition.String
getProcessDefinitionId()
Returns the id of the process definition which created the job.String
getProcessDefinitionKey()
Returns the key of the process definition which created the job.Map<String,Class>
getReferencedEntitiesIdAndClass()
Scope: IN-MEMORY referencesSet<String>
getReferencedEntityIds()
Scope: IN-MEMORY referencesint
getRetries()
Returns the number of retries this job has left.long
getSequenceCounter()
int
getSuspensionState()
String
getTenantId()
The id of the tenant this job belongs to.abstract String
getType()
void
incrementSequenceCounter()
void
init(CommandContext commandContext)
void
insert()
boolean
isInInconsistentLockState()
boolean
isSuspended()
Indicates whether this job is suspended.protected void
postExecute(CommandContext commandContext)
void
postLoad()
protected void
preExecute(CommandContext commandContext)
protected void
removeFailedJobIncident(boolean incidentResolved)
void
resetLock()
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)
String
toString()
void
unlock()
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: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
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:Job
Returns the specific execution on which the job was created.- Specified by:
getExecutionId
in interfaceJob
-
setExecutionId
public void setExecutionId(String executionId)
-
getExecution
public ExecutionEntity 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
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: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
public String getProcessDefinitionId()
Description copied from interface:Job
Returns the id of the process definition which created the job.- Specified by:
getProcessDefinitionId
in interfaceJob
-
setProcessDefinitionId
public void setProcessDefinitionId(String processDefinitionId)
-
getProcessDefinitionKey
public String getProcessDefinitionKey()
Description copied from interface:Job
Returns the key of the process definition which created the job.- Specified by:
getProcessDefinitionKey
in 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: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
public String getJobDefinitionId()
Description copied from interface:Job
The id of theJobDefinition
for this job.- Specified by:
getJobDefinitionId
in 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:Job
Returns the id of the deployment in which context the job was created.- Specified by:
getDeploymentId
in 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:Job
The job's priority that is a hint to job acquisition.- Specified by:
getPriority
in interfaceJob
-
setPriority
public void setPriority(long priority)
-
getTenantId
public String 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
public void setTenantId(String tenantId)
-
getCreateTime
public Date getCreateTime()
Description copied from interface:Job
The date/time when this job has been created- Specified by:
getCreateTime
in 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:
equals
in classAcquirableJobEntity
-
getReferencedEntityIds
public Set<String> 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
public Map<String,Class> 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
public Map<String,Class> getDependentEntities()
Description copied from interface:HasDbReferences
Scope: PERSISTED references
- Specified by:
getDependentEntities
in interfaceHasDbReferences
-
postLoad
public void postLoad()
- Specified by:
postLoad
in interfaceDbEntityLifecycleAware
-
getLastFailureLogId
public String getLastFailureLogId()
-
setLastFailureLogId
public void setLastFailureLogId(String lastFailureLogId)
-
getFailedActivityId
public String getFailedActivityId()
Description copied from interface:Job
Returns the id of the activity on which the last exception occurred.- Specified by:
getFailedActivityId
in interfaceJob
-
setFailedActivityId
public void setFailedActivityId(String failedActivityId)
-
toString
public String toString()
- Overrides:
toString
in classAcquirableJobEntity
-
-