예제 #1
0
  /**
   * Returns the exact size of the marshalled message. Uses method size() of each header to compute
   * the size, so if a Header subclass doesn't implement size() we will use an approximation.
   * However, most relevant header subclasses have size() implemented correctly. (See
   * org.jgroups.tests.SizeTest).
   *
   * @return The number of bytes for the marshalled message
   */
  public long size() {
    long retval =
        Global.BYTE_SIZE // leading byte
            + Global.SHORT_SIZE; // flags
    if (dest_addr != null) retval += Util.size(dest_addr);
    if (src_addr != null) retval += Util.size(src_addr);
    if (buf != null)
      retval +=
          Global.INT_SIZE // length (integer)
              + length; // number of bytes in the buffer

    retval += Global.SHORT_SIZE; // number of headers
    retval += headers.marshalledSize();
    return retval;
  }
예제 #2
0
 @Override
 public int size() {
   return (int)
       (Global.BYTE_SIZE
           + messageID.serializedSize()
           + Bits.size(sequencerNumber)
           + Util.size(destinations));
 }
예제 #3
0
파일: UNICAST.java 프로젝트: an1310/JGroups
 public final int size() {
   int retval = Global.BYTE_SIZE; // type
   switch (type) {
     case DATA:
       retval +=
           Util.size(seqno) // seqno
               + Global.SHORT_SIZE // conn_id
               + Global.BYTE_SIZE; // first
       break;
     case ACK:
       retval += Util.size(seqno) + Global.SHORT_SIZE; // conn_id
       break;
     case SEND_FIRST_SEQNO:
       retval += Util.size(seqno);
       break;
   }
   return retval;
 }
예제 #4
0
파일: GMS.java 프로젝트: jtoerber/JGroups
    public int size() {
      int retval = Global.BYTE_SIZE * 2; // type + merge_rejected

      retval += Global.BYTE_SIZE; // presence view
      retval += Global.BYTE_SIZE; // MergeView or View
      if (view != null) retval += view.serializedSize();

      retval += Util.size(mbr);

      retval += Util.size(mbrs);

      retval += Global.BYTE_SIZE; // presence of join_rsp
      if (join_rsp != null) retval += join_rsp.serializedSize();

      retval += Global.BYTE_SIZE; // presence for my_digest
      if (my_digest != null) retval += my_digest.serializedSize();

      retval += Global.BYTE_SIZE; // presence for merge_id
      if (merge_id != null) retval += merge_id.size();

      retval += Global.BYTE_SIZE; // boolean useFlushIfPresent
      return retval;
    }
예제 #5
0
파일: View.java 프로젝트: vasilev/JGroups
 public int serializedSize() {
   return (int) (vid.serializedSize() + Util.size(members));
 }
예제 #6
0
파일: FORK.java 프로젝트: xiongrl/JGroups
 public int size() {
   return Util.size(fork_stack_id) + Util.size(fork_channel_id);
 }
예제 #7
0
 public int size() {
   return Util.size(encryptedToken);
 }