Hi Guys,
We are trying to replace the default job executor for a custom one that will use spring and the application server thread pool (commonj Work Manager). So we don't use any unmanaged threads.
Reviewing the code we notice that is using another unmanaged thread the one polling for available jobs (JobAcquisitionThread).
It is there a way to replace that component easily?
Which will be the best strategy to follow in this case?.
Thanks in advance.
—
I've implemented this for both, the JobAquisitionThread and the actual job executor for commonj, because WebSphere Application Server does not like it at all, if threads are created without its knowledge. Actually I've rewritten the JobAquisitionThread to use the commonj TimerManager and the Job Executor to use the commonj WorkManager, both configurable via JNDI.
I'm currently trying to find a generalizable way to support different JobExecutor threading models, because other Appservers have different approches for this. There has been some work done already by Ronald van Kuijk (see ACT-34), but I'm unsure how fast this will be integrated.
My solution simply overrides the current JobExecutor (simple extend) in a programmatically done configuration of the Activiti Engine.
If interested I can explain in more detail how I've implemented this.
Maybe Ronald van Kuijk can shed some light on his previous work for ACT-34 and explain if the modifications done so far will somehow be included in Activity soon.
Regards,
Heiko
Hey Bardioc
I really appreciate your answer.
I was actually doing exactly that, extending the job executor and inside this one injecting a TaskExecutor.
This Task executor is configured trough spring and in development is just a simple ThreadPoolTaskExecutor but in
WAS is a WorkManagerTaskExecutor that will use the Threadpoll JNDI name to access it.
Please I am really interested in seeing your approach.
Thanks again.
Just as an FYI, we have this ready in camunda fox with commercial support for webshere.
Daniel Meyer
Activiti developer
camunda services GmbH
Providing Activiti Training & Consulting:
http://www.camunda.com/activiti
Providing stable and supported distributions of Activiti:
http://www.camunda.com/fox
Our Blog: http://www.bpm-guide.de
Sounds great, allthough I think something like this, except the commercial support, should be part of Activiti itself. Right now it is not really compatible with application server in general. From my perspective the core embeddable engine is not really embeddable because of the lacking support for managed threads. These are necessary in almost all application servers and something we should include in Activiti.
Just my two cents
Heiko
PS: The company I'm working for might consider Camunda Fox, because of the commercial support. I'll check into that and get in touch with you guys.
I'll try to get those files and make them available as attachment to a note and PM you!
Hello Heiko,
I could also use these files and would be happy if you could pm me, too.
Thanks in advance
Sebastian
Sebastian
Some call it Europe - I call it home.
Great Thanks!, I'll be waiting.
Hello again,
attached you find a maven project [attachment=1]activiti-websphere.zip[/attachment] that contains the support for WebSphere Application Server. It implements a custom Activiti Configuration based on the Spring Configuration object. The use of Spring here is important, as WebSphere contains a specific Transaction Manager support by using so called Units-of-Work. Spring provides support for this. The attached xml configuration [attachment=0]activiti.cfg.xml.zip[/attachment] shows how to use it.
Make sure you have included the dependency for activiti-spring as well, as it is mandatory for this. The only additional configuration parameter for WebSphere is the workManager JNDI-Name.
It donates the JNDI name of the WorkManager to be used. It is optional, and if not specified, the given default value is used.
For the maven project to compile successfully, you need to provide an IBM specific reference to the com.ibm.ws.prereq.commonj-twm.jar-File, which contains the API code for the WorkManagers. You find this file in your WebSphere application servers 'plugin' directory and need to install it into your local repository:
The implementation uses an ExecutionService for WorkManagers. The idea came to me while I saw that the default JobExecutor uses the ThreadPoolExecutor.
Attention: This module will only work for Activiti 5.9 or above, as the modifications introduced by JIRA ACT-34 are necessary.
The code is free of use. I would like to get a note if you find a mistake, error or something that could be done better.
Best regards,
Heiko
Thank you very much.
I'll review and try to get ideas for my own stuff, also I will provide the requested feedback as well.
Hello Heiko,
I have tested your CommonJ interface code on Weblogic 10.3.4 and it works fine. I created an application level workmanager, plugged it in your JobExecutor via the jndi ref, then created a process with an async service task and all is executed fine.
The thing i cannot judge though from your code is if there are any websphere specific semantics in it with regards to the way you schedule jobs for execution. Do you have an idea about this ?
thanks
[EDIT] it seems that there are some issues though, threads are getting stuck. Going to investigate and load test this.
Jorg Heymans
Hello,
actually not besides the usage of the UOWTransactionManager, which is Websphere specific, the code I wrote should work with all application servers that rely on WorkManagers. A caveat here is, that the WebSphereProcessConfiguration needs to extend the class SpringProcessConfiguration. That is necessary for the Transaction Manager to work correctly. However, if the API of Activiti would open the possibility to 'setJobExecutor()', which is currently not open API, one could simply remove the configuration object and provide a WorkManagerJobExecutor().
Great to hear, that this works for WebLogic too, so I will add another section to my upcoming chapter for Application Server support for the Activiti Documentation.
Thank you,
Heiko
I am seeing this in the weblogic console (the CommonJ is just a rename from the original Websphere* classes)
Looking around a bit this seems harmless though:
Since this is exactly what the AcquireJobsRunnable is doing we can assume it is a non-event. A modest load test also did not reveal any problems, i'll report back in case anything appears.
Jorg Heymans
Hi,
Just a quick question still on this. IIUC the purpose of AcquireJobsRunnable, would this not be something that the commonj TimerManager could/should do ? The TimerManager schedules jobs (= classes implementing TimerListener) to run at a fixed interval in a 'managed' fashion.
cheers
Jorg Heymans
Bringing this up again:
Since ACT-34 has been resolved what's the matter with adding activiti-websphere as an additional module? Maybe it should be generalized and renamed depending on the experiences Jorg made using it on WebLogic.
I could not find a JIRA issue for this topic. Please point me to the existing JIRA issue if existent. Otherwise I will create a new JIRA issue for this subject.
Sebastian
Some call it Europe - I call it home.
+1 for creating 'activiti-commonj' module
Jorg Heymans
Hello all together
fyi: it is now possible not to extend EngineConfiguration anymore but instead inject a custom jobExecutor it using activiti.cfg.xml, I believe this is a result of ACT-34
Heiko, in the first reply you've mentioned that you have a version of JobAcquisitionThread implemented with TimerManager but it isn't in the attachment, would you mind sharing it with us?
The only issue I have seen under WL so far is the reports on stuck WorkManager threads (see heymro's comment) which are harmless and can be suppressed and the only stuck thread is actually JobAcqusitionThread running continuously in WorkManager
And of course another +1 for creating an activiti-commonj module for proper application server deployments.
regards,
Andrey