06-16-2012 08:25 PM
<process id="ccaProcess" name="ccaProcess">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="servicetask1" name="Build-1" activiti:class="com.mycomp.step.cca.bpm.CcaDelegate"></serviceTask>
<serviceTask id="servicetask2" name="Build-2" activiti:class="com.mycomp.step.cca.bpm.CcaDelegate"></serviceTask>
<parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow4" name="" sourceRef="servicetask1" targetRef="parallelgateway2"></sequenceFlow>
<sequenceFlow id="flow5" name="" sourceRef="servicetask2" targetRef="parallelgateway2"></sequenceFlow>
<sequenceFlow id="flow6" name="" sourceRef="parallelgateway2" targetRef="endevent1"></sequenceFlow>
<parallelGateway id="parallelgateway3" name="Parallel Gateway"></parallelGateway>
<sequenceFlow id="flow8" name="" sourceRef="parallelgateway3" targetRef="servicetask1"></sequenceFlow>
<sequenceFlow id="flow9" name="" sourceRef="parallelgateway3" targetRef="servicetask2"></sequenceFlow>
<sequenceFlow id="flow10" name="" sourceRef="startevent1" targetRef="parallelgateway3"></sequenceFlow>
</process>
runtimeService.startProcessInstanceByKey("ccaProcess");
07-02-2012 01:18 AM
07-02-2012 08:10 AM
07-04-2012 03:55 AM
public class YourCompanyService {
private Set<String> processLocks = new HashSet<…>;
…
public boolean printTheCard(String cardIdentifier) {
// Correlate between card-id and task/process to use
String processId = runtimeService.createtaskQuery()……singleResult();
// JVM-wide lock for this specific use-case.
boolean isSafe = false;
synchronized(this) {
isSafe = processLocks.contains(processId);
if(isSafe) {
processLocks.add(processId);
}
}
if(!isSafe) {
throw new MyCompanyException("looks like you're too late…");
}
// important, release the lock in "finally"
try {
// Finish task
taskService……
….
}
finally
{
synchronized(this) {
processLocks.remove(processId);
}
}
}
}
[/img]
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.