use of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor in project camunda-bpm-platform by camunda.
the class TestJobExecutorActivateFalse_JBOSS method shouldNotActiateJobExecutor.
@Test
public void shouldNotActiateJobExecutor() {
ProcessEngine processEngine = processEngineService.getProcessEngine("jobExecutorActivate-FALSE-engine");
ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration();
JobExecutor jobExecutor = ((ProcessEngineConfigurationImpl) configuration).getJobExecutor();
assertFalse(jobExecutor.isActive());
processEngine = processEngineService.getProcessEngine("jobExecutorActivate-UNDEFINED-engine");
configuration = processEngine.getProcessEngineConfiguration();
jobExecutor = ((ProcessEngineConfigurationImpl) configuration).getJobExecutor();
assertTrue(jobExecutor.isActive());
}
use of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor in project camunda-bpm-platform by camunda.
the class CdiProcessEngineTestCase method waitForJobExecutorOnCondition.
public void waitForJobExecutorOnCondition(long maxMillisToWait, long intervalMillis, Callable<Boolean> condition) {
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
try {
Timer timer = new Timer();
InteruptTask task = new InteruptTask(Thread.currentThread());
timer.schedule(task, maxMillisToWait);
boolean conditionIsViolated = true;
try {
while (conditionIsViolated) {
Thread.sleep(intervalMillis);
conditionIsViolated = !condition.call();
}
} catch (InterruptedException e) {
} catch (Exception e) {
throw new ProcessEngineException("Exception while waiting on condition: " + e.getMessage(), e);
} finally {
timer.cancel();
}
if (conditionIsViolated) {
throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded");
}
} finally {
jobExecutor.shutdown();
}
}
use of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor in project camunda-bpm-platform by camunda.
the class StartJobAcquisitionStep method performOperationStep.
public void performOperationStep(DeploymentOperation operationContext) {
final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
final AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
ClassLoader configurationClassloader = null;
if (processApplication != null) {
configurationClassloader = processApplication.getProcessApplicationClassloader();
} else {
configurationClassloader = ProcessEngineConfiguration.class.getClassLoader();
}
String configurationClassName = jobAcquisitionXml.getJobExecutorClassName();
if (configurationClassName == null || configurationClassName.isEmpty()) {
configurationClassName = RuntimeContainerJobExecutor.class.getName();
}
// create & instantiate the job executor class
Class<? extends JobExecutor> jobExecutorClass = loadJobExecutorClass(configurationClassloader, configurationClassName);
JobExecutor jobExecutor = instantiateJobExecutor(jobExecutorClass);
// apply properties
Map<String, String> properties = jobAcquisitionXml.getProperties();
PropertyHelper.applyProperties(jobExecutor, properties);
// construct service for job executor
JmxManagedJobExecutor jmxManagedJobExecutor = new JmxManagedJobExecutor(jobExecutor);
// deploy the job executor service into the container
serviceContainer.startService(ServiceTypes.JOB_EXECUTOR, jobAcquisitionXml.getName(), jmxManagedJobExecutor);
}
use of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor in project camunda-bpm-platform by camunda.
the class StartProcessEngineStep method getJobExecutorService.
protected JobExecutor getJobExecutorService(final PlatformServiceContainer serviceContainer) {
// lookup container managed job executor
String jobAcquisitionName = processEngineXml.getJobAcquisitionName();
JobExecutor jobExecutor = serviceContainer.getServiceValue(ServiceTypes.JOB_EXECUTOR, jobAcquisitionName);
return jobExecutor;
}
use of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor in project camunda-bpm-platform by camunda.
the class TestHelper method waitForJobExecutorToProcessAllJobs.
public static void waitForJobExecutorToProcessAllJobs(ProcessEngineConfigurationImpl processEngineConfiguration, long maxMillisToWait, long intervalMillis) {
JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
jobExecutor.start();
try {
Timer timer = new Timer();
InteruptTask task = new InteruptTask(Thread.currentThread());
timer.schedule(task, maxMillisToWait);
boolean areJobsAvailable = true;
try {
while (areJobsAvailable && !task.isTimeLimitExceeded()) {
Thread.sleep(intervalMillis);
areJobsAvailable = areJobsAvailable(processEngineConfiguration);
}
} catch (InterruptedException e) {
} finally {
timer.cancel();
}
if (areJobsAvailable) {
throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded");
}
} finally {
jobExecutor.shutdown();
}
}
Aggregations