We found out the solution. First of all in our scenario we have to implement ActivityBehavior interface, not JavaDelegate, precisely SignallableActivityBehavior interface. When execution of task implemented with this interface ends, process flow stops, so after our thread finishes its job, it can signal execution of this task and take appropriate transition ie.
1. Service task execution method:
<code>
public void execute(ActivityExecution execution) throws CodeException, InterruptedException {
new ProcessThread(execution).start();
}
</code>
2. External example thread run method:
<code>
public void run() {
try {
sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
runtimeService.signal(execution.getId());
}
</code>
3. Service task implementation of SignallableActivityBehavior needs override signal method:
<code>
@Override
public void signal(ActivityExecution execution, String signalEvent,
Object signalData) throws Exception {
PvmTransition transition = execution.getActivity().getOutgoingTransitions().get(0);
execution.take(transition);
}
</code>
This is more less simple way of making process suspend and then activate it from place it ended.