Example #1
0
  public void broadcast(final int gateIndex, final MemoryView buffer) {
    // sanity check.
    if (buffer == null) throw new IllegalArgumentException("buffer == null");

    final UUID srcTaskID = runtime.getNodeDescriptor().taskID;
    buffer.setRefCount(outputBinding.get(gateIndex).size());

    for (int i = 0; i < outputBinding.get(gateIndex).size(); ++i) {
      final UUID dstTaskID =
          runtime.getBindingDescriptor().outputGateBindings.get(gateIndex).get(i).taskID;
      final IOEvents.TransferBufferEvent event =
          new IOEvents.TransferBufferEvent(srcTaskID, dstTaskID, buffer);
      outputGates.get(gateIndex).writeDataToChannel(i, event);
    }
  }