Configured Async Executor doesn't work

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Configured Async Executor doesn't work

Jump to solution

Hi,

i've got a question about configurate the async executor.

I've setup a Process Engine with my own async executor with this code:

ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
DefaultAsyncJobExecutor asyncExecutor = new DefaultAsyncJobExecutor();


asyncExecutor.setCorePoolSize(10);
asyncExecutor.setMaxAsyncJobsDuePerAcquisition(5);
asyncExecutor.setMaxPoolSize(50);


processEngineConfiguration.setAsyncExecutor(asyncExecutor);
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();

Later when i run my process it seems like my async executor is not used. There are just two threads used which leeds to the assumption that activiti uses still the default async executor with a default corePoolSize of 2.

Another try was this code:

         ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

with the activiti.cfg.xml i uploaded. Same problem. Just two threads are working.

Can someone help me with this?

Greetings and Thanks

1 Solution

Accepted Solutions
Highlighted
Intermediate

Re: Configured Async Executor doesn't work

Jump to solution

It doesn't look like you have enabled the AsyncExecutor:

processEngineConfiguration.setAsyncExecutorEnabled(true);
processEngineConfiguration.setAsyncExecutorActivate(true);

I believe you will need both of these in order to override the default job executor.

You should be able to tell from the logs.

Greg

View solution in original post

8 Replies
Highlighted
Intermediate

Re: Configured Async Executor doesn't work

Jump to solution

It doesn't look like you have enabled the AsyncExecutor:

processEngineConfiguration.setAsyncExecutorEnabled(true);
processEngineConfiguration.setAsyncExecutorActivate(true);

I believe you will need both of these in order to override the default job executor.

You should be able to tell from the logs.

Greg

View solution in original post

Highlighted
Member II

Re: Configured Async Executor doesn't work

Jump to solution

Yep. This worked. Thank you very much!

Now i have another question.  Before it worked i started the process in eclipse and i saw it on the log in tomcat/wildfly. Now it seems that the process is executed in eclipse supported by the activiti libraries and independent from the engine i deployed on the application server. In fact the application server does not even have to run for executing my process now... That's not the scenario i want. Actually i want to have a jar and bar deployment on an application server like tomcat or wildfly and the process should be executed from a async executor which was configurated by me on the server.

Is this possible?

I hope this makes sense. It is not for a productive system. I want an comparison between different bpms for my study and activti has now an execution witch is different and therefore not comparable...

So as a question: How can i alter or configure the async executor which is used from the engine which is deployed on a tomcat with the activiti-explorer.war?

Highlighted
Established Member II

Re: Configured Async Executor doesn't work

Jump to solution

HI Jürgen Krauß ,

How can i alter or configure the async executor which is used from the engine which is deployed on a tomcat with the activiti-explorer.war?

I believe your question has been asked and answered by the following threads:

- Suggested by Joram: How build activiti-explorer sources to file war , basically just clone the code, change it and rebuild with Maven.

- Another approach by gregdavisfromnj _ :  , this is more advanced approach with Maven Overlays.

Hope this helps,

Thanks,

Thong Huynh

Highlighted
Member II

Re: Configured Async Executor doesn't work

Jump to solution

Yep ok. Thanks. I thought about that. Hoped there would be another way then alter the code by itself and build my own warfile. Something like a config file or something. I will look into this.

Highlighted
Member II

Re: Configured Async Executor doesn't work

Jump to solution

I tried this now. 

I cloned the project from git and changed the variables in DefaultAsyncJobExecutor in package org.activiti.impl.asyncexecutor tor following:

/** The minimal number of threads that are kept alive in the threadpool for job execution */
protected int corePoolSize = 10;

/** The maximum number of threads that are kept alive in the threadpool for job execution */
protected int maxPoolSize = 10;

/** The size of the queue on which jobs to be executed are placed */
protected int queueSize = 100;

If i deploy the new warfile and start the server the console says:
Creating executor service with corePoolSize 2...


Is there another location where the software can pull that 2 for corePoolSize from?

Highlighted
Intermediate

Re: Configured Async Executor doesn't work

Jump to solution

Yes, as indicated in my first reply.

This is set in the process engine configuration.

Greg

Highlighted
Member II

Re: Configured Async Executor doesn't work

Jump to solution

Yay. It worked. Why is the configuration in DefaultAsyncJobExecutor.java existing?

Think i'm finished now with Activiti. :-)

Thanks a lot to Greg Harley and Thong Huynh. You guys gave me a great guidance for my work.

Highlighted
Intermediate

Re: Configured Async Executor doesn't work

Jump to solution

No worries Jurgen. I thin the defaults are listed in the DefaultAsyncJobExecutor.java class just in case you forget to configure the properties in the engine.

Glad you got it working.

Greg