Hi Maceij,
It is a very common problem when we use sub-process, because there is no way to get a sub-process from it's super-process.
Consider about which of using is better:
1.
//
// Is there any risk for a session already closed exception?
//
ProcesssInstance subProcessInstance = execution.getSubProcessInstance();
if (subProcessInstance != null) {
executionService.signalExecutionById(subProcessInstance.getId());
}.
2.
String subProcessInstanceId = execution.getSubProcessInstanceId();
if (subProcessInstanceId != null) {
executionService.signalExecutionById(subProcessInstanceId);
}
3.
if (execution.hasSubProcessInstance()) {
executionService.signalExecutionById(execution.getSubProcessInstanceId());
}
4.
// Don't like this way, need to add too much methods in API.
executionService.signalSubProcessInstance(executionId);