[Design of JBoss jBPM] - Initialise thread context classloader
by camunda
Hi.
I am working on https://jira.jboss.org/jira/browse/JBPM-1448 (jBPM does not initialize thread context classloader).
First of all, why I want to do this: This enables you to put Interfaces or other stuff used in your action classes in the par, so they end up in the database. Because the ProcessClassLoader will become ContextClassLoader it is used to load everything correctly...
But this is only half the way I want to go. Image you put jbpm in your app-server (or ESB) once, but have different applications (ear, esb, ...) using it. Now I write an own small MBean, which is a registry where processes register which class loaders are responsible for "their" action classes. My own ProcessClassLoader now also looks in this registry and by doing so, it can even load action classes or other stuff correctly from the right EAR, even if a process was maybe started by the web-console, not knowing the ear... But more on this idea later.
Back to setting the ContextClassLoader. My approach to implement it is adding this code
| ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
| try {
| Thread.currentThread().setContextClassLoader(
| ClassLoaderUtil.getProcessClassLoader(processDefinition));
|
| .... existing code ...
| }
| finally {
| Thread.currentThread().setContextClassLoader(oldCl);
| }
|
to the following methods:
- Action.execute
- Decision.execute
- TaskController.initializeVariables
- TaskController.submitParameters
- AssignmentHandler.performAssignmentDelegation
On all these places I have the ProcessDefinition on hand, so it is possible to do... These are all places I found where the ProcessClassLoader is used and all Delegation use cases I remembered. So it is not too much work to do and consistent overall in jBPM (not like the proposed workaround to build an own base action class where the context class loader is set).
What do you guys think?
Cheers
Bernd
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178720#4178720
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4178720
16 years, 4 months
Re: jBPM SEAM integration
by Tom Baeyens
let's say friday around 11am. by that time, i'm sure that i will have time be fully
prepared.
regards, tom.
Pete Muir wrote:
>
> On 24 Sep 2008, at 14:44, Tom Baeyens wrote:
>
>> Pete,
>>
>> There are 2 topics I would like to discuss with you:
>>
>> 1) https://jira.jboss.org/jira/browse/JBPM-1166
>
> Ok. I thought we had sorted this?
>
>> 2) Moving Pageflow to SEAM. The problem of having pageflow in jBPM is
>> that that introduces a circular dependency. The pageflow node depends
>> on SEAM and SEAM depends on jBPM pageflow. This circular dependency
>> also prevents us from testing pageflow in our own codebase.
>
> What does this involve? The public class Page extends Node is already in
> the seam code base, so is this just some configuration?
>
>> Next monday will be JIRA freeze we'll have to decide by then how we
>> are going to deal with this situation.
>>
>> Are you available for a call about this topic later this week ?
>
> Perhaps sometime on Friday morning?
--
regards, tom.
16 years, 4 months
jBPM SEAM integration
by Tom Baeyens
Pete,
There are 2 topics I would like to discuss with you:
1) https://jira.jboss.org/jira/browse/JBPM-1166
2) Moving Pageflow to SEAM. The problem of having pageflow in jBPM is that that
introduces a circular dependency. The pageflow node depends on SEAM and SEAM depends
on jBPM pageflow. This circular dependency also prevents us from testing pageflow in
our own codebase.
Next monday will be JIRA freeze we'll have to decide by then how we are going to deal
with this situation.
Are you available for a call about this topic later this week ?
--
regards, tom.
16 years, 4 months