Class AbstractBatchJobHandler<T extends BatchConfiguration>
java.lang.Object
org.camunda.bpm.engine.impl.batch.AbstractBatchJobHandler<T>
- All Implemented Interfaces:
BatchJobHandler<T>,OptimisticLockingListener,JobHandler<BatchJobConfiguration>
- Direct Known Subclasses:
BatchSetRemovalTimeJobHandler,BatchSetVariablesHandler,DecisionSetRemovalTimeJobHandler,DeleteHistoricDecisionInstancesJobHandler,DeleteHistoricProcessInstancesJobHandler,DeleteProcessInstancesJobHandler,MessageCorrelationBatchJobHandler,MigrationBatchJobHandler,ModificationBatchJobHandler,ProcessSetRemovalTimeJobHandler,RestartProcessInstancesJobHandler,SetExternalTaskRetriesJobHandler,SetJobRetriesJobHandler,UpdateProcessInstancesSuspendStateJobHandler
public abstract class AbstractBatchJobHandler<T extends BatchConfiguration>
extends Object
implements BatchJobHandler<T>, OptimisticLockingListener
Common methods for batch job handlers based on list of ids, providing serialization, configuration instantiation, etc.
- Author:
- Askar Akhmerov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcalculateInvocationsPerBatchJob(String batchType, T configuration) Determine the number of invocations ber patch job.protected JobEntitycreateBatchJob(BatchEntity batch, ByteArrayEntity configuration) protected abstract TcreateJobConfiguration(T configuration, List<String> processIdsForJob) protected voidcreateJobEntities(BatchEntity batch, T configuration, String deploymentId, List<String> processIds, int invocationsPerBatchJob) booleancreateJobs(BatchEntity batch) Creates batch jobs for a batch.voiddeleteJobs(BatchEntity batch) Delete all jobs for a batch.final voidexecute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) protected abstract voidexecuteHandler(T configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) failedOperation(DbOperation operation) Signifies that an operation failed due to optimistic locking.The type of the entity for which this listener should be notified.abstract JobDeclaration<BatchJobContext,MessageEntity> Get the job declaration for batch jobs.protected abstract AbstractBatchConfigurationObjectConverter<T>newConfiguration(String canonicalString) voidonDelete(BatchJobConfiguration configuration, JobEntity jobEntity) Clean up before job is deleted.protected voidpostProcessJob(T configuration, JobEntity job, T jobConfiguration) readConfiguration(byte[] serializedConfiguration) Read the serialized configuration of the batch.protected voidsanitizeMappings(DeploymentMappings idMappings, List<String> ids) protected ByteArrayEntitysaveConfiguration(ByteArrayManager byteArrayManager, T jobConfiguration) byte[]writeConfiguration(T configuration) Converts the configuration of the batch to a byte array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.camunda.bpm.engine.impl.jobexecutor.JobHandler
getType
-
Constructor Details
-
AbstractBatchJobHandler
public AbstractBatchJobHandler()
-
-
Method Details
-
getJobDeclaration
Description copied from interface:BatchJobHandlerGet the job declaration for batch jobs.- Specified by:
getJobDeclarationin interfaceBatchJobHandler<T extends BatchConfiguration>- Returns:
- the batch job declaration
-
createJobs
Description copied from interface:BatchJobHandlerCreates batch jobs for a batch.- Specified by:
createJobsin interfaceBatchJobHandler<T extends BatchConfiguration>- Parameters:
batch- the batch to create jobs for- Returns:
- true of no more jobs have to be created for this batch, false otherwise
-
execute
public final void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) - Specified by:
executein interfaceJobHandler<T extends BatchConfiguration>
-
executeHandler
protected abstract void executeHandler(T configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) -
sanitizeMappings
-
createJobEntities
protected void createJobEntities(BatchEntity batch, T configuration, String deploymentId, List<String> processIds, int invocationsPerBatchJob) -
createJobConfiguration
-
postProcessJob
-
createBatchJob
-
deleteJobs
Description copied from interface:BatchJobHandlerDelete all jobs for a batch.- Specified by:
deleteJobsin interfaceBatchJobHandler<T extends BatchConfiguration>- Parameters:
batch- the batch to delete jobs for
-
newConfiguration
- Specified by:
newConfigurationin interfaceJobHandler<T extends BatchConfiguration>
-
onDelete
Description copied from interface:JobHandlerClean up before job is deleted. Like removing of auxiliary entities specific for this job handler.- Specified by:
onDeletein interfaceJobHandler<T extends BatchConfiguration>- Parameters:
configuration- the job handler configurationjobEntity- the job entity to be deleted
-
saveConfiguration
-
writeConfiguration
Description copied from interface:BatchJobHandlerConverts the configuration of the batch to a byte array.- Specified by:
writeConfigurationin interfaceBatchJobHandler<T extends BatchConfiguration>- Parameters:
configuration- the configuration object- Returns:
- the serialized configuration
-
readConfiguration
Description copied from interface:BatchJobHandlerRead the serialized configuration of the batch.- Specified by:
readConfigurationin interfaceBatchJobHandler<T extends BatchConfiguration>- Parameters:
serializedConfiguration- the serialized configuration- Returns:
- the deserialized configuration object
-
getJsonConverterInstance
-
getEntityType
Description copied from interface:OptimisticLockingListenerThe type of the entity for which this listener should be notified. If the implementation returns 'null', the listener is notified for all entity types.- Specified by:
getEntityTypein interfaceOptimisticLockingListener- Returns:
- the entity type for which the listener should be notified.
-
failedOperation
Description copied from interface:OptimisticLockingListenerSignifies that an operation failed due to optimistic locking.- Specified by:
failedOperationin interfaceOptimisticLockingListener- Parameters:
operation- the failed operation.- Returns:
OptimisticLockingResultthat instructs the caller how to handle the result of the failed operation.
-
calculateInvocationsPerBatchJob
Description copied from interface:BatchJobHandlerDetermine the number of invocations ber patch job. This can be defined by the related batch job handler specifically or otherwise taken from the engine configuration.- Specified by:
calculateInvocationsPerBatchJobin interfaceBatchJobHandler<T extends BatchConfiguration>- Parameters:
batchType- the batch's type to help determine any engine configuration related to itconfiguration- the configuration object- Returns:
- the number of invocations ber patch job
-