[jboss-user] [JBoss jBPM] - Re: does this design make sense?
do-not-reply at jboss.com
Thu Jul 10 18:18:07 EDT 2008
I'm not at work so I can't remember the exact details of the calls etc however it would go something like that presented below. DISLAIMER: I'm not sure if this is enough to simulate a lock an prevent concurrency issues or not.
A task is meant to be a unit of work that the user performs via the UI. Generally tasks are assigned to a pool/group. So if an individual is a member of that pool/group then they can see that task. Tasks are then pulled or pushed from the pool to an individuals personal task list to prevent multiple people picking up the task. Once on the personal task list the user then completes the task. A fairly straight forward usage would be to have a task inside a task node and, by default I believe, when you signal the token into the task node it creates the task instance. When the token leaves the task node it closes the task. There are a lot of scenarios when using tasks but I believe that is probably the most common usage.
Ok so to use a task as a lock I would propose
1. In an action handler at the start of the process a call to
TaskMgmtInstance.createTaskInstance() to create a task solely to be used as a lock. (see section 11.2.2 of the user guide)
2. Create a new group in the database
3. Assign the task to the group via TaskInstance.setPooledActors()
4. Before executing an update of the process instance, e.g. a signal, you need to make a call to acquire the lock (i.e. you need to get the task assigned to you i.e. you pull it from the group list onto your task list). This is done by TaskInstance.setActorId().
5. Determine if you have the lock. Stated another way determine if the special task is on your personal work list with a call to TaskMgmtInstance.findTaskInstancesByActorId()
6. If you have the lock then you are free to carryout your actions on the process instance.
7. Free up the lock by doing TaskInstance.setActorId(null). This effectively takes the task out of your list and puts it back on the pooled/group list.
A timer may be needed to automatically free up the lock/task if not user(Section 13.1 of user manual).
It's very crude and I'm not even sure if it would work but I would love your thought on the idea.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163723#4163723
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163723
More information about the jboss-user