Beispiel #1
0
        private JobExecutorXml getJobExecutorXml(DeploymentOperation operationContext)
        {
            BpmPlatformXml bpmPlatformXml = operationContext.getAttachment(Attachments.BPM_PLATFORM_XML);
            JobExecutorXml jobExecutorXml = bpmPlatformXml.JobExecutor;

            return(jobExecutorXml);
        }
Beispiel #2
0
        public virtual void testParseBpmPlatformXmlOneEngine()
        {
            BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_one_engine.xml")).execute().BpmPlatformXml;

            assertNotNull(bpmPlatformXml);
            assertNotNull(bpmPlatformXml.JobExecutor);
            assertEquals(1, bpmPlatformXml.ProcessEngines.Count);

            JobExecutorXml jobExecutorXml = bpmPlatformXml.JobExecutor;

            assertEquals(1, jobExecutorXml.JobAcquisitions.Count);
            assertThat(jobExecutorXml.Properties.Count, @is(2));

            JobAcquisitionXml jobAcquisitionXml = jobExecutorXml.JobAcquisitions[0];

            assertEquals("default", jobAcquisitionXml.Name);
            assertEquals("org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor", jobAcquisitionXml.JobExecutorClassName);

            assertEquals(2, jobAcquisitionXml.Properties.Count);

            ProcessEngineXml engineXml = bpmPlatformXml.ProcessEngines[0];

            assertEquals("engine1", engineXml.Name);
            assertEquals("default", engineXml.JobAcquisitionName);

            IDictionary <string, string> properties = engineXml.Properties;

            assertNotNull(properties);
            assertEquals(0, properties.Count);

            IList <ProcessEnginePluginXml> plugins = engineXml.Plugins;

            assertNotNull(plugins);
            assertEquals(0, plugins.Count);
        }
Beispiel #3
0
        public override void performOperationStep(DeploymentOperation operationContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.spi.PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
            PlatformServiceContainer serviceContainer = operationContext.ServiceContainer;

            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 <ThreadStart> threadPoolQueue = new ArrayBlockingQueue <ThreadStart>(queueSize);

            ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, threadPoolQueue);

            threadPoolExecutor.RejectedExecutionHandler = 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);
        }
Beispiel #4
0
        /// <summary>
        /// Checks the validation to see if properties are present, which will be ignored
        /// in this environment so we can log a warning.
        /// </summary>
        private void checkConfiguration(JobExecutorXml jobExecutorXml)
        {
            IDictionary <string, string> properties = jobExecutorXml.Properties;

            foreach (KeyValuePair <string, string> entry in properties.SetOfKeyValuePairs())
            {
                LOGGER.warning("Property " + entry.Key + " with value " + entry.Value + " from bpm-platform.xml will be ignored for JobExecutor.");
            }
        }
Beispiel #5
0
        private long getKeepAliveTime(JobExecutorXml jobExecutorXml)
        {
            string keepAliveTime = jobExecutorXml.Properties[org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml_Fields.KEEP_ALIVE_TIME];

            if (string.ReferenceEquals(keepAliveTime, null))
            {
                return(DEFAULT_KEEP_ALIVE_TIME_MS);
            }
            return(long.Parse(keepAliveTime));
        }
Beispiel #6
0
        private int getQueueSize(JobExecutorXml jobExecutorXml)
        {
            string queueSize = jobExecutorXml.Properties[org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml_Fields.QUEUE_SIZE];

            if (string.ReferenceEquals(queueSize, null))
            {
                return(DEFAULT_QUEUE_SIZE);
            }
            return(int.Parse(queueSize));
        }
Beispiel #7
0
        private int getCorePoolSize(JobExecutorXml jobExecutorXml)
        {
            string corePoolSize = jobExecutorXml.Properties[org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml_Fields.CORE_POOL_SIZE];

            if (string.ReferenceEquals(corePoolSize, null))
            {
                return(DEFAULT_CORE_POOL_SIZE);
            }
            return(int.Parse(corePoolSize));
        }
Beispiel #8
0
        public virtual void testParseBpmPlatformXmlNoEngine()
        {
            BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_no_engine.xml")).execute().BpmPlatformXml;

            assertNotNull(bpmPlatformXml);
            assertNotNull(bpmPlatformXml.JobExecutor);
            assertEquals(0, bpmPlatformXml.ProcessEngines.Count);

            JobExecutorXml jobExecutorXml = bpmPlatformXml.JobExecutor;

            assertEquals(1, jobExecutorXml.JobAcquisitions.Count);

            JobAcquisitionXml jobAcquisitionXml = jobExecutorXml.JobAcquisitions[0];

            assertEquals("default", jobAcquisitionXml.Name);
            assertEquals("org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor", jobAcquisitionXml.JobExecutorClassName);

            assertEquals(2, jobAcquisitionXml.Properties.Count);
        }
Beispiel #9
0
 public BpmPlatformXmlImpl(JobExecutorXml jobExecutor, IList <ProcessEngineXml> processEngines)
 {
     this.jobExecutor    = jobExecutor;
     this.processEngines = processEngines;
 }