use a command:
processEngine.execute(new Command() {
public Object execute(Environment env) {
Execution exe = processInstance.findActiveExecutionIn("subprocess-task");
String subprocessid = ((ExecutionImpl)execution).getSubprocessInstance();
System.out.printlnl("subprocessid is: " + subprocessid);
return null;
}
});