public void consume()

in saga-core/src/main/java/org/apache/servicecomb/saga/core/TransactionTaskConsumer.java [59:84]


  public void consume(Collection<Node<SagaRequest>> nodes) {
    List<Future<Operation>> futures = new ArrayList<>(nodes.size());
    for (Node<SagaRequest> node : nodes) {
      SagaRequest request = node.value();
      if (sagaContext.isChosenChild(request)) {
        futures.add(futureOf(request));
      }
    }

    for (int i = 0; i < futures.size(); i++) {
      try {
        executorService.take().get();
      } catch (ExecutionException e) {
        if (e.getCause() instanceof SagaStartFailedException) {
          throw ((SagaStartFailedException) e.getCause());
        }
        if (e.getCause() instanceof TransactionAbortedException) {
          throw ((TransactionAbortedException) e.getCause());
        }
        throw new TransactionFailedException(e.getCause());
      } catch (InterruptedException e) {
        // TODO: 7/29/2017 what shall we do when system is shutting down?
        throw new TransactionFailedException(e);
      }
    }
  }