private void handleEmit(ShellResponseMsg shellMsg) {
    List<Tuple> anchors = new ArrayList<Tuple>();
    List<String> recvAnchors = shellMsg.getAnchors();
    if (recvAnchors != null) {
      for (String anchor : recvAnchors) {
        Tuple t = _inputs.get(anchor);
        if (t == null) {
          throw new RuntimeException("Anchored onto " + anchor + " after ack/fail");
        }
        anchors.add(t);
      }
    }

    if (shellMsg.getTask() == 0) {
      List<Integer> outtasks = _collector.emit(shellMsg.getStream(), anchors, shellMsg.getTuple());
      if (shellMsg.areTaskIdsNeeded()) {
        Preconditions.checkNotNull(outtasks);
        _process.writeTaskIds(outtasks);
      }
    } else {
      _collector.emitDirect(
          (int) shellMsg.getTask(), shellMsg.getStream(), anchors, shellMsg.getTuple());
    }
  }