org.camunda.bpm.engine.impl.persistence.entity
Class JobEntity

java.lang.Object
  extended by org.camunda.bpm.engine.impl.persistence.entity.JobEntity
All Implemented Interfaces:
Serializable, DbEntity, HasDbRevision, Job
Direct Known Subclasses:
MessageEntity, TimerEntity

public abstract class JobEntity
extends Object
implements Serializable, Job, DbEntity, HasDbRevision

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:
Serialized Form

Field Summary
protected  String activityId
           
static boolean DEFAULT_EXCLUSIVE
           
static int DEFAULT_RETRIES
           
protected  String deploymentId
           
protected  Date duedate
           
protected  ByteArrayEntity exceptionByteArray
           
protected  String exceptionByteArrayId
           
protected  String exceptionMessage
           
protected  boolean executing
           
protected  ExecutionEntity execution
           
protected  String executionId
           
protected  String id
           
protected  boolean isExclusive
           
protected  JobDefinition jobDefinition
           
protected  String jobDefinitionId
           
protected  String jobHandlerConfiguration
           
protected  String jobHandlerType
           
protected  Date lockExpirationTime
           
protected  String lockOwner
           
static int MAX_EXCEPTION_MESSAGE_LENGTH
          Note: String.length() counts Unicode supplementary characters twice, so for a String consisting only of those, the limit is effectively MAX_EXCEPTION_MESSAGE_LENGTH / 2
protected  long priority
           
protected  String processDefinitionId
           
protected  String processDefinitionKey
           
protected  String processInstanceId
           
protected  int retries
           
protected  int revision
           
protected  long sequenceCounter
           
protected  int suspensionState
           
protected  String tenantId
           
 
Constructor Summary
JobEntity()
           
 
Method Summary
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()
           
 String getDeploymentId()
          Returns the id of the deployment in which context the job was created.
 Date getDuedate()
          Returns the date on which this job is supposed to be processed.
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 getId()
          Returns the unique identifier for this job.
 JobDefinition getJobDefinition()
           
 String getJobDefinitionId()
          The id of the JobDefinition for this job.
protected  JobHandler getJobHandler()
           
 JobHandlerConfiguration getJobHandlerConfiguration()
           
 String getJobHandlerConfigurationRaw()
           
 String getJobHandlerType()
           
 Date getLockExpirationTime()
           
 String getLockOwner()
           
 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.
 String getProcessInstanceId()
          Returns the id of the process instance which execution created the job.
 int getRetries()
          Returns the number of retries this job has left.
 int getRevision()
           
 int getRevisionNext()
           
 long getSequenceCounter()
           
 int getSuspensionState()
           
 String getTenantId()
          The id of the tenant this job belongs to.
abstract  String getType()
           
 int hashCode()
           
 void incrementSequenceCounter()
           
 void insert()
           
 boolean isExclusive()
           
 boolean isExecuting()
           
 boolean isInInconsistentLockState()
           
 boolean isSuspended()
          Indicates whether this job is suspended.
protected  void postExecute(CommandContext commandContext)
           
protected  void preExecute(CommandContext commandContext)
           
protected  void removeFailedJobIncident(boolean incidentResolved)
           
 void resetLock()
           
 void setActivityId(String activityId)
           
 void setDeploymentId(String deploymentId)
           
 void setDuedate(Date duedate)
           
 void setExceptionMessage(String exceptionMessage)
           
 void setExceptionStacktrace(String exception)
           
 void setExclusive(boolean isExclusive)
           
 void setExecuting(boolean executing)
           
 void setExecution(ExecutionEntity execution)
           
 void setExecutionId(String executionId)
           
 void setId(String id)
           
 void setJobDefinition(JobDefinition jobDefinition)
           
 void setJobDefinitionId(String jobDefinitionId)
           
 void setJobHandlerConfiguration(JobHandlerConfiguration configuration)
           
 void setJobHandlerConfigurationRaw(String jobHandlerConfiguration)
           
 void setJobHandlerType(String jobHandlerType)
           
 void setLockExpirationTime(Date claimedUntil)
           
 void setLockOwner(String claimedBy)
           
 void setPriority(long priority)
           
 void setProcessDefinitionId(String processDefinitionId)
           
 void setProcessDefinitionKey(String processDefinitionKey)
           
 void setProcessInstanceId(String processInstanceId)
           
 void setRetries(int retries)
           
 void setRetriesFromPersistence(int retries)
           
 void setRevision(int revision)
           
 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 java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_EXCLUSIVE

public static final boolean DEFAULT_EXCLUSIVE
See Also:
Constant Field Values

DEFAULT_RETRIES

public static final int DEFAULT_RETRIES
See Also:
Constant Field Values

MAX_EXCEPTION_MESSAGE_LENGTH

public static int MAX_EXCEPTION_MESSAGE_LENGTH
Note: String.length() counts Unicode supplementary characters twice, so for a String consisting only of those, the limit is effectively MAX_EXCEPTION_MESSAGE_LENGTH / 2


id

protected String id

revision

protected int revision

duedate

protected Date duedate

lockOwner

protected String lockOwner

lockExpirationTime

protected Date lockExpirationTime

executionId

protected String executionId

processInstanceId

protected String processInstanceId

processDefinitionId

protected String processDefinitionId

processDefinitionKey

protected String processDefinitionKey

isExclusive

protected boolean isExclusive

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

executing

protected boolean executing

activityId

protected String activityId

jobDefinition

protected JobDefinition jobDefinition

execution

protected ExecutionEntity execution

sequenceCounter

protected long sequenceCounter
Constructor Detail

JobEntity

public JobEntity()
Method Detail

execute

public void execute(CommandContext commandContext)

preExecute

protected void preExecute(CommandContext commandContext)

postExecute

protected void postExecute(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 interface DbEntity

getRevisionNext

public int getRevisionNext()
Specified by:
getRevisionNext in interface HasDbRevision

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 interface Job

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 interface Job

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 interface Job
Returns:
true if this Job is currently suspended.

getLockOwner

public String getLockOwner()

setLockOwner

public void setLockOwner(String claimedBy)

getLockExpirationTime

public Date getLockExpirationTime()

setLockExpirationTime

public void setLockExpirationTime(Date claimedUntil)

getProcessInstanceId

public String getProcessInstanceId()
Description copied from interface: Job
Returns the id of the process instance which execution created the job.

Specified by:
getProcessInstanceId in interface Job

setProcessInstanceId

public void setProcessInstanceId(String processInstanceId)

getProcessDefinitionId

public String getProcessDefinitionId()
Description copied from interface: Job
Returns the id of the process definition which created the job.

Specified by:
getProcessDefinitionId in interface Job

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 interface Job

setProcessDefinitionKey

public void setProcessDefinitionKey(String processDefinitionKey)

isExclusive

public boolean isExclusive()

setExclusive

public void setExclusive(boolean isExclusive)

getId

public String getId()
Description copied from interface: Job
Returns the unique identifier for this job.

Specified by:
getId in interface DbEntity
Specified by:
getId in interface Job

setId

public void setId(String id)
Specified by:
setId in interface DbEntity

getDuedate

public Date getDuedate()
Description copied from interface: Job
Returns the date on which this job is supposed to be processed.

Specified by:
getDuedate in interface Job

setDuedate

public void setDuedate(Date duedate)

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)

getRevision

public int getRevision()
Specified by:
getRevision in interface HasDbRevision

setRevision

public void setRevision(int revision)
Specified by:
setRevision in interface HasDbRevision

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, use ManagementService.getJobExceptionStacktrace(String)

Specified by:
getExceptionMessage in interface Job

getJobDefinitionId

public String getJobDefinitionId()
Description copied from interface: Job
The id of the JobDefinition for this job.

Specified by:
getJobDefinitionId in interface Job

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()

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 interface Job

setDeploymentId

public void setDeploymentId(String deploymentId)

isInInconsistentLockState

public boolean isInInconsistentLockState()

resetLock

public void resetLock()

isExecuting

public boolean isExecuting()

setExecuting

public void setExecuting(boolean executing)

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 interface Job

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 be null if the job belongs to no single tenant.

Specified by:
getTenantId in interface Job

setTenantId

public void setTenantId(String tenantId)

ensureActivityIdInitialized

protected void ensureActivityIdInitialized()

unlock

public void unlock()
Unlock from current lock owner


getType

public abstract String getType()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2016 camunda services GmbH. All rights reserved.