@Override
  public void dispatch (TaskExecution aTask) {
    List<List> branches = aTask.getList("branches", List.class);
    Assert.notNull(branches,"'branches' property can't be null");
    SimpleTaskExecution forkTask = SimpleTaskExecution.of(aTask);
    forkTask.setStartTime(new Date ());
    forkTask.setStatus(TaskStatus.STARTED);
    taskExecutionRepo.merge(forkTask);
    if(branches.size() > 0) {
      counterRepository.set(aTask.getId(), branches.size());
      for(int i=0; i<branches.size(); i++) {
        List branch = branches.get(i);
        Assert.isTrue(branch.size()>0, "branch " + i + " does not contain any tasks");
        Map<String,Object> task = (Map<String, Object>) branch.get(0);
        SimpleTaskExecution execution = SimpleTaskExecution.of(task);
        execution.setId(UUIDGenerator.generate());
        execution.setStatus(TaskStatus.CREATED);
        execution.setCreateTime(new Date());
        execution.set("branch", i);
        execution.setTaskNumber(1);
        execution.setJobId(aTask.getJobId());
        execution.setParentId(aTask.getId());
        execution.setPriority(aTask.getPriority());
        MapContext context = new MapContext (contextRepository.peek(aTask.getId()));
        contextRepository.push(aTask.getId()+"/"+i, context);
        contextRepository.push(execution.getId(), context);
        TaskExecution evaluatedExecution = taskEvaluator.evaluate(execution, context);
        taskExecutionRepo.create(evaluatedExecution);
        taskDispatcher.dispatch(evaluatedExecution);
      }
    }
    else {
      SimpleTaskExecution completion = SimpleTaskExecution.of(aTask);
      completion.setEndTime(new Date());
      messageBroker.send(Queues.COMPLETIONS, completion);
    }
  }
Implements a Fork/Join construct. 

Fork/Join tasks are expected to have a "branches" 
property which contains a list of task list.

Each branch executes in isolation, in parallel 
to the other branches in the fork and has its 
own context namespace.

<pre>
  - type: fork
    branches: 
      - - name: randomNumber
          label: Generate a random number
          type: randomInt
          startInclusive: 0
          endInclusive: 5000
        
        - type: sleep
          millis: ${randomNumber}
        
      - - name: randomNumber
          label: Generate a random number
          type: randomInt
          startInclusive: 0
          endInclusive: 5000
        
        - type: sleep
          millis: ${randomNumber}
</pre>

@author Arik Cohen
@since May 11, 2017
@see ForkTaskCompletionHandler
src/main/java/com/creactiviti/piper/core/task/ForkTaskDispatcher.java