@Override
  public void toData(DataOutput out,
      SerializationContext context) throws IOException {
    super.toData(out, context);
    out.writeInt(msgNum);
    out.writeBoolean(lastMsg);
    out.writeInt(processorId);

    // soubhik. fix for ticket 40670
    try {
      DataSerializer.writeObject(result, out);
    } catch (Exception ex) {
      if (ex instanceof CancelException) {
        throw new DistributedSystemDisconnectedException(ex);
      }
      NotSerializableException ioEx =
          new NotSerializableException(result.getClass().getName());
      ioEx.initCause(ex);
      throw ioEx;
    }
  }
@param msgNum message number in this series (0-based)
@param lastMsg if this is the last message in this series
geode-core/src/main/java/org/apache/geode/internal/cache/FunctionStreamingReplyMessage.java