Search in sources :

Example 1 with JobExecutorXml

use of org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml in project camunda-bpm-platform by camunda.

the class StartManagedThreadPoolStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    JobExecutorXml jobExecutorXml = getJobExecutorXml(operationContext);
    int queueSize = getQueueSize(jobExecutorXml);
    int corePoolSize = getCorePoolSize(jobExecutorXml);
    int maxPoolSize = getMaxPoolSize(jobExecutorXml);
    long keepAliveTime = getKeepAliveTime(jobExecutorXml);
    // initialize Queue & Executor services
    BlockingQueue<Runnable> threadPoolQueue = new ArrayBlockingQueue<Runnable>(queueSize);
    ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, threadPoolQueue);
    threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
    // construct the service for the thread pool
    JmxManagedThreadPool managedThreadPool = new JmxManagedThreadPool(threadPoolQueue, threadPoolExecutor);
    // install the service into the container
    serviceContainer.startService(ServiceTypes.BPM_PLATFORM, RuntimeContainerDelegateImpl.SERVICE_NAME_EXECUTOR, managedThreadPool);
}
Also used : ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) JmxManagedThreadPool(org.camunda.bpm.container.impl.jmx.services.JmxManagedThreadPool) JobExecutorXml(org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Example 2 with JobExecutorXml

use of org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml in project camunda-bpm-platform by camunda.

the class StartManagedThreadPoolStep method getJobExecutorXml.

private JobExecutorXml getJobExecutorXml(DeploymentOperation operationContext) {
    BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML);
    JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor();
    return jobExecutorXml;
}
Also used : BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml) JobExecutorXml(org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml)

Example 3 with JobExecutorXml

use of org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml in project camunda-bpm-platform by camunda.

the class StartJobExecutorStep method getJobExecutorXml.

private JobExecutorXml getJobExecutorXml(DeploymentOperation operationContext) {
    BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML);
    JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor();
    return jobExecutorXml;
}
Also used : BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml) JobExecutorXml(org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml)

Example 4 with JobExecutorXml

use of org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml in project camunda-bpm-platform by camunda.

the class BpmPlatformXmlParserTest method testParseBpmPlatformXmlNoEngine.

public void testParseBpmPlatformXmlNoEngine() {
    BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_no_engine.xml")).execute().getBpmPlatformXml();
    assertNotNull(bpmPlatformXml);
    assertNotNull(bpmPlatformXml.getJobExecutor());
    assertEquals(0, bpmPlatformXml.getProcessEngines().size());
    JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor();
    assertEquals(1, jobExecutorXml.getJobAcquisitions().size());
    JobAcquisitionXml jobAcquisitionXml = jobExecutorXml.getJobAcquisitions().get(0);
    assertEquals("default", jobAcquisitionXml.getName());
    assertEquals("org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor", jobAcquisitionXml.getJobExecutorClassName());
    assertEquals(2, jobAcquisitionXml.getProperties().size());
}
Also used : BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml) JobExecutorXml(org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml) JobAcquisitionXml(org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml)

Example 5 with JobExecutorXml

use of org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml in project camunda-bpm-platform by camunda.

the class BpmPlatformXmlParserTest method testParseBpmPlatformXmlOneEngine.

public void testParseBpmPlatformXmlOneEngine() {
    BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_one_engine.xml")).execute().getBpmPlatformXml();
    assertNotNull(bpmPlatformXml);
    assertNotNull(bpmPlatformXml.getJobExecutor());
    assertEquals(1, bpmPlatformXml.getProcessEngines().size());
    JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor();
    assertEquals(1, jobExecutorXml.getJobAcquisitions().size());
    assertThat(jobExecutorXml.getProperties().size(), is(2));
    JobAcquisitionXml jobAcquisitionXml = jobExecutorXml.getJobAcquisitions().get(0);
    assertEquals("default", jobAcquisitionXml.getName());
    assertEquals("org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor", jobAcquisitionXml.getJobExecutorClassName());
    assertEquals(2, jobAcquisitionXml.getProperties().size());
    ProcessEngineXml engineXml = bpmPlatformXml.getProcessEngines().get(0);
    assertEquals("engine1", engineXml.getName());
    assertEquals("default", engineXml.getJobAcquisitionName());
    Map<String, String> properties = engineXml.getProperties();
    assertNotNull(properties);
    assertEquals(0, properties.size());
    List<ProcessEnginePluginXml> plugins = engineXml.getPlugins();
    assertNotNull(plugins);
    assertEquals(0, plugins.size());
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEngineXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml) BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml) JobExecutorXml(org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml) JobAcquisitionXml(org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml)

Aggregations

JobExecutorXml (org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml)5 BpmPlatformXml (org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml)4 JobAcquisitionXml (org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 JmxManagedThreadPool (org.camunda.bpm.container.impl.jmx.services.JmxManagedThreadPool)1 ProcessEnginePluginXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml)1 ProcessEngineXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml)1 PlatformServiceContainer (org.camunda.bpm.container.impl.spi.PlatformServiceContainer)1