Example #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;
  }
Example #2
0
 @Override
 public int size() {
   return (int)
       (Global.BYTE_SIZE
           + messageID.serializedSize()
           + Bits.size(sequencerNumber)
           + Util.size(destinations));
 }
Example #3
0
 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;
 }
Example #4
0
    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;
    }
Example #5
0
 public int serializedSize() {
   return (int) (vid.serializedSize() + Util.size(members));
 }
Example #6
0
 public int size() {
   return Util.size(fork_stack_id) + Util.size(fork_channel_id);
 }
Example #7
0
 public int size() {
   return Util.size(encryptedToken);
 }