Sergey Sazonov [
https://community.jboss.org/people/sergey.sazonov] created the discussion
"Re: JEE + jBPM + threads"
To view the discussion, visit:
https://community.jboss.org/message/817328#817328
--------------------------------------------------------------
Thanks, Chris.
I think I should be more descriptive from the beggining. I have really huge amount of long
running persistent processes (up to 100 000 simulteniously). They actually don't do
any work but wait for external events and may contain timers. Each process may create
several subprocesses, so I use one KnowledgeSession for one process with all children to
avoid mixing of contexts. According to "jPBM5 developers guide" my algorithm for
jBPM processing contains of several standart steps:
1. Create process.
2. Run.
3. Dispose.
4. If some external event happens then load a process.
5. Run.
6. Dispose.
If I have a timer node in my process, I don't want to keep a process instance in
memory and wait for an additional timer thread (and don't want to block main thread as
well), I create EJB timer with an equal time period and dispose a session. And if my EJB
timer is triggered, I just load a linked process. So I don't have to reserve many
server resources to keep this army of jBPM process instances.
I don't keep any state at runtime (only KnowledgeBase is shared), each call to jBPM
code occurs in stateless EJB bean to gain better scalability.
p.s. Besides that each jBPM thread doesn't know anything about servlet container's
context and now I don't know any legal and easy way to change that.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/817328#817328]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]