Class JobEntity
- java.lang.Object
-
- org.camunda.bpm.engine.impl.persistence.entity.AcquirableJobEntity
-
- org.camunda.bpm.engine.impl.persistence.entity.JobEntity
-
- All Implemented Interfaces:
java.io.Serializable
,DbEntity
,DbEntityLifecycleAware
,HasDbReferences
,HasDbRevision
,Job
- Direct Known Subclasses:
EverLivingJobEntity
,MessageEntity
,TimerEntity
public abstract class JobEntity extends AcquirableJobEntity implements java.io.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 java.lang.String
activityId
protected java.util.Date
createTime
static int
DEFAULT_RETRIES
protected java.lang.String
deploymentId
protected ByteArrayEntity
exceptionByteArray
protected java.lang.String
exceptionByteArrayId
protected java.lang.String
exceptionMessage
protected ExecutionEntity
execution
protected java.lang.String
executionId
protected java.lang.String
failedActivityId
protected JobDefinition
jobDefinition
protected java.lang.String
jobDefinitionId
protected java.lang.String
jobHandlerConfiguration
protected java.lang.String
jobHandlerType
protected java.lang.String
lastFailureLogId
protected java.util.Map<java.lang.String,java.lang.Class>
persistedDependentEntities
protected long
priority
protected java.lang.String
processDefinitionId
protected java.lang.String
processDefinitionKey
protected int
retries
protected long
sequenceCounter
protected int
suspensionState
protected java.lang.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(java.lang.Object obj)
void
execute(CommandContext commandContext)
java.lang.String
getActivityId()
java.util.Date
getCreateTime()
The date/time when this job has been createdjava.util.Map<java.lang.String,java.lang.Class>
getDependentEntities()
Scope: PERSISTED referencesjava.lang.String
getDeploymentId()
Returns the id of the deployment in which context the job was created.protected ByteArrayEntity
getExceptionByteArray()
java.lang.String
getExceptionByteArrayId()
java.lang.String
getExceptionMessage()
Returns the message of the exception that occurred, the last time the job was executed.java.lang.String
getExceptionStacktrace()
ExecutionEntity
getExecution()
java.lang.String
getExecutionId()
Returns the specific execution on which the job was created.java.lang.String
getFailedActivityId()
Returns the id of the activity on which the last exception occurred.JobDefinition
getJobDefinition()
java.lang.String
getJobDefinitionId()
The id of theJobDefinition
for this job.protected JobHandler
getJobHandler()
JobHandlerConfiguration
getJobHandlerConfiguration()
java.lang.String
getJobHandlerConfigurationRaw()
java.lang.String
getJobHandlerType()
java.lang.String
getLastFailureLogId()
java.lang.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.java.lang.String
getProcessDefinitionId()
Returns the id of the process definition which created the job.java.lang.String
getProcessDefinitionKey()
Returns the key of the process definition which created the job.java.util.Map<java.lang.String,java.lang.Class>
getReferencedEntitiesIdAndClass()
Scope: IN-MEMORY referencesjava.util.Set<java.lang.String>
getReferencedEntityIds()
Scope: IN-MEMORY referencesint
getRetries()
Returns the number of retries this job has left.long
getSequenceCounter()
int
getSuspensionState()
java.lang.String
getTenantId()
The id of the tenant this job belongs to.abstract java.lang.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(java.lang.String activityId)
void
setCreateTime(java.util.Date createTime)
void
setDeploymentId(java.lang.String deploymentId)
void
setExceptionMessage(java.lang.String exceptionMessage)
void
setExceptionStacktrace(java.lang.String exception)
void
setExecution(ExecutionEntity execution)
void
setExecutionId(java.lang.String executionId)
void
setFailedActivityId(java.lang.String failedActivityId)
void
setJobDefinition(JobDefinition jobDefinition)
void
setJobDefinitionId(java.lang.String jobDefinitionId)
void
setJobHandlerConfiguration(JobHandlerConfiguration configuration)
void
setJobHandlerConfigurationRaw(java.lang.String jobHandlerConfiguration)
void
setJobHandlerType(java.lang.String jobHandlerType)
void
setLastFailureLogId(java.lang.String lastFailureLogId)
void
setPriority(long priority)
void
setProcessDefinitionId(java.lang.String processDefinitionId)
void
setProcessDefinitionKey(java.lang.String processDefinitionKey)
void
setRetries(int retries)
void
setRetriesFromPersistence(int retries)
void
setSequenceCounter(long sequenceCounter)
void
setSuspensionState(int state)
void
setTenantId(java.lang.String tenantId)
java.lang.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 java.lang.String executionId
-
processDefinitionId
protected java.lang.String processDefinitionId
-
processDefinitionKey
protected java.lang.String processDefinitionKey
-
retries
protected int retries
-
suspensionState
protected int suspensionState
-
jobHandlerType
protected java.lang.String jobHandlerType
-
jobHandlerConfiguration
protected java.lang.String jobHandlerConfiguration
-
exceptionByteArray
protected ByteArrayEntity exceptionByteArray
-
exceptionByteArrayId
protected java.lang.String exceptionByteArrayId
-
exceptionMessage
protected java.lang.String exceptionMessage
-
deploymentId
protected java.lang.String deploymentId
-
jobDefinitionId
protected java.lang.String jobDefinitionId
-
priority
protected long priority
-
tenantId
protected java.lang.String tenantId
-
createTime
protected java.util.Date createTime
-
activityId
protected java.lang.String activityId
-
jobDefinition
protected JobDefinition jobDefinition
-
execution
protected ExecutionEntity execution
-
sequenceCounter
protected long sequenceCounter
-
lastFailureLogId
protected java.lang.String lastFailureLogId
-
failedActivityId
protected java.lang.String failedActivityId
-
persistedDependentEntities
protected java.util.Map<java.lang.String,java.lang.Class> persistedDependentEntities
-
-
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 java.lang.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 java.lang.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(java.lang.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 java.lang.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 java.lang.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(java.lang.String processDefinitionId)
-
getProcessDefinitionKey
public java.lang.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(java.lang.String processDefinitionKey)
-
setExceptionStacktrace
public void setExceptionStacktrace(java.lang.String exception)
-
getJobHandler
protected JobHandler getJobHandler()
-
getJobHandlerConfiguration
public JobHandlerConfiguration getJobHandlerConfiguration()
-
setJobHandlerConfiguration
public void setJobHandlerConfiguration(JobHandlerConfiguration configuration)
-
getJobHandlerType
public java.lang.String getJobHandlerType()
-
setJobHandlerType
public void setJobHandlerType(java.lang.String jobHandlerType)
-
getJobHandlerConfigurationRaw
public java.lang.String getJobHandlerConfigurationRaw()
-
setJobHandlerConfigurationRaw
public void setJobHandlerConfigurationRaw(java.lang.String jobHandlerConfiguration)
-
getExceptionMessage
public java.lang.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 java.lang.String getJobDefinitionId()
Description copied from interface:Job
The id of theJobDefinition
for this job.- Specified by:
getJobDefinitionId
in interfaceJob
-
setJobDefinitionId
public void setJobDefinitionId(java.lang.String jobDefinitionId)
-
getJobDefinition
public JobDefinition getJobDefinition()
-
setJobDefinition
public void setJobDefinition(JobDefinition jobDefinition)
-
ensureJobDefinitionInitialized
protected void ensureJobDefinitionInitialized()
-
setExceptionMessage
public void setExceptionMessage(java.lang.String exceptionMessage)
-
getExceptionByteArrayId
public java.lang.String getExceptionByteArrayId()
-
getExceptionByteArray
protected ByteArrayEntity getExceptionByteArray()
-
ensureExceptionByteArrayInitialized
protected void ensureExceptionByteArrayInitialized()
-
clearFailedJobException
protected void clearFailedJobException()
-
getDeploymentId
public java.lang.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(java.lang.String deploymentId)
-
isInInconsistentLockState
public boolean isInInconsistentLockState()
-
resetLock
public void resetLock()
-
getActivityId
public java.lang.String getActivityId()
-
setActivityId
public void setActivityId(java.lang.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 java.lang.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(java.lang.String tenantId)
-
getCreateTime
public java.util.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(java.util.Date createTime)
-
ensureActivityIdInitialized
protected void ensureActivityIdInitialized()
-
unlock
public void unlock()
Unlock from current lock owner
-
getType
public abstract java.lang.String getType()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classAcquirableJobEntity
-
getReferencedEntityIds
public java.util.Set<java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.util.Map<java.lang.String,java.lang.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 java.lang.String getLastFailureLogId()
-
setLastFailureLogId
public void setLastFailureLogId(java.lang.String lastFailureLogId)
-
getFailedActivityId
public java.lang.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(java.lang.String failedActivityId)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAcquirableJobEntity
-
-