[jboss-user] [jBPM] - Multiple Threads on a Stateful Session
Richard Evans
do-not-reply at jboss.com
Thu Jun 28 12:00:44 EDT 2012
Richard Evans [https://community.jboss.org/people/r3vans] created the discussion
"Multiple Threads on a Stateful Session"
To view the discussion, visit: https://community.jboss.org/message/744840#744840
--------------------------------------------------------------
I am trying to get an multi-threaded application to run against a single kSession.
I have made every serviceTask asynchronous but I CANNOT eliminate problems that I think are related to persistence context.
Each Handler lools like this:
executeWorkItem(WorkItem workItem, WorkItemManager manager ) {
WorkHandlerRunner task = new WorkHanderRunner ( kSession, workItem, this)
threadPoolTaskExecutor.execute ( task )
}
WorkHandlerRunner run looks like this
Constructor saves kSesssion, workItem and workItemHandler
run() {
WorkItemManager manager = kSession.getWorkItemManager()
results = runInTransaction ( manager )
manager.completeWorkItem ( workItem.getId(), results)
}
@Transactional
Map<String, Object> runInTransaction ( WorkItemManager manager) {
// the doExecute does the business work and does not call into kbpm code
return handler.doExecuteWorkItem (workItem, manager)
}
When run it sometimes works for a while but eventually falls over with a mixture of exceptions like
- JPAWorkItemManager.internalWorkItem ( JPAWorkItemManager.java 43 ) - NPA
- ProcessInstanceImp.getProcess ( kruntime null )
I am trying to get a better handle on what happens and when but wonder whether at this light level of reporting someone can spot the obvious mistake.
Cheers,
Richard
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/744840#744840]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120628/8a4de8b8/attachment.html
More information about the jboss-user
mailing list