use of org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor in project camunda-bpm-platform by camunda.
the class ProcessEngineConfigurationImpl method initJobExecutor.
// job executor /////////////////////////////////////////////////////////////
protected void initJobExecutor() {
if (jobExecutor == null) {
jobExecutor = new DefaultJobExecutor();
}
jobHandlers = new HashMap<String, JobHandler>();
TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler();
jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), timerExecuteNestedActivityJobHandler);
TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler();
jobHandlers.put(timerCatchIntermediateEvent.getType(), timerCatchIntermediateEvent);
TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler();
jobHandlers.put(timerStartEvent.getType(), timerStartEvent);
TimerStartEventSubprocessJobHandler timerStartEventSubprocess = new TimerStartEventSubprocessJobHandler();
jobHandlers.put(timerStartEventSubprocess.getType(), timerStartEventSubprocess);
AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler();
jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler);
ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler();
jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler);
TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler();
jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler);
TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler();
jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler);
TimerSuspendJobDefinitionHandler suspendJobDefinitionHandler = new TimerSuspendJobDefinitionHandler();
jobHandlers.put(suspendJobDefinitionHandler.getType(), suspendJobDefinitionHandler);
TimerActivateJobDefinitionHandler activateJobDefinitionHandler = new TimerActivateJobDefinitionHandler();
jobHandlers.put(activateJobDefinitionHandler.getType(), activateJobDefinitionHandler);
BatchSeedJobHandler batchSeedJobHandler = new BatchSeedJobHandler();
jobHandlers.put(batchSeedJobHandler.getType(), batchSeedJobHandler);
BatchMonitorJobHandler batchMonitorJobHandler = new BatchMonitorJobHandler();
jobHandlers.put(batchMonitorJobHandler.getType(), batchMonitorJobHandler);
HistoryCleanupJobHandler historyCleanupJobHandler = new HistoryCleanupJobHandler();
jobHandlers.put(historyCleanupJobHandler.getType(), historyCleanupJobHandler);
for (JobHandler batchHandler : batchHandlers.values()) {
jobHandlers.put(batchHandler.getType(), batchHandler);
}
// if we have custom job handlers, register them
if (getCustomJobHandlers() != null) {
for (JobHandler customJobHandler : getCustomJobHandlers()) {
jobHandlers.put(customJobHandler.getType(), customJobHandler);
}
}
jobExecutor.setAutoActivate(jobExecutorActivate);
if (jobExecutor.getRejectedJobsHandler() == null) {
if (customRejectedJobsHandler != null) {
jobExecutor.setRejectedJobsHandler(customRejectedJobsHandler);
} else {
jobExecutor.setRejectedJobsHandler(new NotifyAcquisitionRejectedJobsHandler());
}
}
}
use of org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor in project camunda-bpm-platform by camunda.
the class PropertyHelperTest method testJobExecutorConfigurationProperties.
public void testJobExecutorConfigurationProperties() {
// given
JobExecutor jobExecutor = new DefaultJobExecutor();
Map<String, String> propertiesToSet = new HashMap<String, String>();
propertiesToSet.put(MAX_JOBS_PER_ACQUISITION, Integer.toString(Integer.MAX_VALUE));
propertiesToSet.put(MAX_WAIT, Long.toString(Long.MAX_VALUE));
propertiesToSet.put(WAIT_INCREASE_FACTOR, Float.toString(Float.MAX_VALUE));
propertiesToSet.put(BACKOFF_TIME_IN_MILLIS, Integer.toString(Integer.MAX_VALUE));
// when
PropertyHelper.applyProperties(jobExecutor, propertiesToSet);
// then
Assert.assertEquals(Integer.MAX_VALUE, jobExecutor.getMaxJobsPerAcquisition());
Assert.assertEquals(Long.MAX_VALUE, jobExecutor.getMaxWait());
Assert.assertEquals(Float.MAX_VALUE, jobExecutor.getWaitIncreaseFactor(), 0.0001d);
Assert.assertEquals(Integer.MAX_VALUE, jobExecutor.getBackoffTimeInMillis());
}
Aggregations