code: protected void ensureExecutionTreeInitialized() {
      List<ExecutionEntity> executions = Context.getCommandContext()
        .getExecutionManager()
        .findExecutionsByProcessInstanceId(processInstanceId);
  
      ExecutionEntity processInstance = isProcessInstanceExecution() ? this : null;
  
      if(processInstance == null) {
        for (ExecutionEntity execution : executions) {
          if (execution.isProcessInstanceExecution()) {
            processInstance = execution;
          }
        }
      }
  
      processInstance.restoreProcessInstance(executions, null, null, null, null, null, null);
    }
docs: Fetch all the executions inside the same process instance as list and then
  reconstruct the complete execution tree.
  
  In many cases this is an optimization over fetching the execution tree
  lazily. Usually we need all executions anyway and it is preferable to fetch
  more data in a single query (maybe even too much data) then to run multiple
  queries, each returning a fraction of the data.
  
  The most important consideration here is network roundtrip: If the process
  engine and database run on separate hosts, network roundtrip has to be
  added to each query. Economizing on the number of queries economizes on
  network roundtrip. The tradeoff here is network roundtrip vs. throughput:
  multiple roundtrips carrying small chucks of data vs. a single roundtrip
  carrying more data.