jBPM中task的signalling和blocking属性

今天发现在创建一个task实例之后,数据库中会出现两个task记录,不同的只是其中一个的issignaling是r,另一个是null.而且这两个使用的也是同一个token.查看jBPM的手册中的task management发现这样解释的:

A signalling task instance is a task instance that, when completed, can send a signal to its token to continue the process execution. Task instances can be blocking, meaning that the related token (=path of execution) is not allowed to leave the task-node before the task instance is completed. By default task instances are signalling and non-blocking.

信令和阻塞,当执行完成时发送一个signal给token..而blocking意味着token被阻塞在task-node直到task完成.不理解这个要在什么样的情况下使用,是不是分支任务的时候?

但是还是很奇怪,我这里只是 把start-state的task改成blocking=true就解决问题了.难道和state有关系吗?

有可能是我在生成processInstance时候有问题. 代码如下:

// create a new process instance to run
ProcessInstance processInstance = new ProcessInstance(processDefinition);
// create a new taskinstance for the start task
TaskInstance taskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();
//signal
taskInstance.getToken().signal();
context.save(processInstance);

这样会生成两个taskinstance,而且一个是signaling一个是blocking??????

Comments are closed.