public Resp emit()

in src/main/java/com/twitter/nodes/Node.java [899:928]


  public Resp emit() {
    if (Futures.completedWithSuccess(promise)) {
      try {
        return Await.result(promise);
      } catch (Exception e) {
        LOG.error(e, "Exception during emit()");
        throw new RuntimeException("Could not read promise", e);
      }
    }

    // It's logically impossible to get here if:
    //    apply() was called on the terminating graph node
    //    AND the promise's node was added as a dependency.
    // So it's possible to get here if you just create a node and then call emit() on it w/o
    // calling apply() on the terminating graph node.
    // Assuming the graph was used properly, then it's possible to get here if the node wasn't added
    //
    // Report back to the user which state the node was in, but also remind them to add the node
    // as a dependency.

    if (Futures.completedWithFailure(promise)) {
      throw new IllegalStateException(
          String.format("NODE[%s]: Attempting to call emit() on failed required node.  "
              + "Did you forget to add this node as a required dependency?", getName()));
    }

    throw new IllegalStateException(
        String.format("NODE[%s]: Attempting to call emit() on an incomplete required node.  "
            + "Did you forget to add this node as a required dependency?", getName()));
  }