Search in sources :

Example 1 with PlatformServiceContainer

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

the class StopJobExecutorStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    Set<String> jobExecutorServiceNames = serviceContainer.getServiceNames(ServiceTypes.JOB_EXECUTOR);
    for (String serviceName : jobExecutorServiceNames) {
        try {
            serviceContainer.stopService(serviceName);
        } catch (Exception e) {
            LOG.exceptionWhileStopping("Job Executor Service", serviceName, e);
        }
    }
}
Also used : PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer)

Example 2 with PlatformServiceContainer

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

the class UndeployProcessArchivesStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
    final JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processApplication.getName());
    ensureNotNull("Cannot find process application with name " + processApplication.getName(), "deployedProcessApplication", deployedProcessApplication);
    Map<String, DeployedProcessArchive> deploymentMap = deployedProcessApplication.getProcessArchiveDeploymentMap();
    if (deploymentMap != null) {
        List<ProcessesXml> processesXmls = deployedProcessApplication.getProcessesXmls();
        for (ProcessesXml processesXml : processesXmls) {
            for (ProcessArchiveXml parsedProcessArchive : processesXml.getProcessArchives()) {
                DeployedProcessArchive deployedProcessArchive = deploymentMap.get(parsedProcessArchive.getName());
                if (deployedProcessArchive != null) {
                    operationContext.addStep(new UndeployProcessArchiveStep(deployedProcessApplication, parsedProcessArchive, deployedProcessArchive.getProcessEngineName()));
                }
            }
        }
    }
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) DeployedProcessArchive(org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive) ProcessesXml(org.camunda.bpm.application.impl.metadata.spi.ProcessesXml) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) ProcessArchiveXml(org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml) JmxManagedProcessApplication(org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication)

Example 3 with PlatformServiceContainer

use of org.camunda.bpm.container.impl.spi.PlatformServiceContainer 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 4 with PlatformServiceContainer

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

the class InjectionUtil method getProcessEngines.

public static List<ProcessEngine> getProcessEngines(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    final ProcessApplicationInfo processApplicationInfo = getProcessApplicationInfo(operationContext);
    List<ProcessEngine> processEngines = new ArrayList<ProcessEngine>();
    for (ProcessApplicationDeploymentInfo deploymentInfo : processApplicationInfo.getDeploymentInfo()) {
        String processEngineName = deploymentInfo.getProcessEngineName();
        processEngines.add((ProcessEngine) serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, processEngineName));
    }
    return processEngines;
}
Also used : ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) ArrayList(java.util.ArrayList) ProcessApplicationInfo(org.camunda.bpm.application.ProcessApplicationInfo) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 5 with PlatformServiceContainer

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

the class InjectionUtil method getProcessApplicationInfo.

public static ProcessApplicationInfo getProcessApplicationInfo(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
    JmxManagedProcessApplication managedPa = serviceContainer.getServiceValue(ServiceTypes.PROCESS_APPLICATION, processApplication.getName());
    return managedPa.getProcessApplicationInfo();
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) JmxManagedProcessApplication(org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication)

Aggregations

PlatformServiceContainer (org.camunda.bpm.container.impl.spi.PlatformServiceContainer)23 AbstractProcessApplication (org.camunda.bpm.application.AbstractProcessApplication)9 JmxManagedProcessApplication (org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication)5 DeployedProcessArchive (org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive)4 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)4 ProcessesXml (org.camunda.bpm.application.impl.metadata.spi.ProcessesXml)3 JmxManagedBpmPlatformPlugins (org.camunda.bpm.container.impl.jmx.services.JmxManagedBpmPlatformPlugins)2 JobExecutor (org.camunda.bpm.engine.impl.jobexecutor.JobExecutor)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)1 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)1 ProcessApplicationInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationInfoImpl)1 ProcessArchiveXml (org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml)1 JmxManagedJobExecutor (org.camunda.bpm.container.impl.jmx.services.JmxManagedJobExecutor)1