コード例 #1
0
ファイル: ControlMessage.java プロジェクト: nilgnat/jstorm
 /**
  * encode the current Control Message into a channel buffer
  *
  * @throws Exception
  */
 ChannelBuffer buffer() throws Exception {
   ChannelBufferOutputStream bout =
       new ChannelBufferOutputStream(ChannelBuffers.directBuffer(encodeLength()));
   write(bout);
   bout.close();
   return bout.buffer();
 }
コード例 #2
0
ファイル: MessageBatch.java プロジェクト: matif84/storm
  /** create a buffer containing the encoding of this batch */
  ChannelBuffer buffer() throws Exception {
    ChannelBufferOutputStream bout =
        new ChannelBufferOutputStream(ChannelBuffers.directBuffer(encoded_length));

    for (TaskMessage msg : msgs) {
      writeTaskMessage(bout, msg);
    }

    // add a END_OF_BATCH indicator
    ControlMessage.EOB_MESSAGE.write(bout);

    bout.close();

    return bout.buffer();
  }