@Override
 public void encodeRest(final HornetQBuffer buffer) {
   buffer.writeBoolean(synchronizationIsFinished);
   buffer.writeBoolean(allowsAutoFailBack);
   buffer.writeString(nodeID);
   if (synchronizationIsFinished) return;
   buffer.writeByte(dataType.code);
   buffer.writeInt(ids.length);
   for (long id : ids) {
     buffer.writeLong(id);
   }
 }
  @Override
  public HornetQBuffer encode(final RemotingConnection connection) {
    HornetQBuffer buffer = message.getEncodedBuffer();

    // Sanity check
    if (buffer.writerIndex() != message.getEndOfMessagePosition()) {
      throw new IllegalStateException("Wrong encode position");
    }

    buffer.writeBoolean(requiresResponse);

    size = buffer.writerIndex();

    // Write standard headers

    int len = size - DataConstants.SIZE_INT;
    buffer.setInt(0, len);
    buffer.setByte(DataConstants.SIZE_INT, getType());
    buffer.setLong(DataConstants.SIZE_INT + DataConstants.SIZE_BYTE, channelID);

    // Position reader for reading by Netty
    buffer.readerIndex(0);

    message.resetCopied();

    return buffer;
  }
 public static void encodeConfigs(
     HornetQBuffer buffer, List<Pair<TransportConfiguration, TransportConfiguration>> configs) {
   buffer.writeInt(configs == null ? 0 : configs.size());
   if (configs != null) {
     for (Pair<TransportConfiguration, TransportConfiguration> pair : configs) {
       encode(buffer, pair.getA());
       boolean backup = (pair.getB() != null);
       buffer.writeBoolean(backup);
       if (backup) {
         encode(buffer, pair.getB());
       }
     }
   }
 }
示例#4
0
 public void encodeHeadersAndProperties(final HornetQBuffer buffer) {
   buffer.writeLong(messageID);
   buffer.writeNullableSimpleString(address);
   if (userID == null) {
     buffer.writeByte(DataConstants.NULL);
   } else {
     buffer.writeByte(DataConstants.NOT_NULL);
     buffer.writeBytes(userID.asBytes());
   }
   buffer.writeByte(type);
   buffer.writeBoolean(durable);
   buffer.writeLong(expiration);
   buffer.writeLong(timestamp);
   buffer.writeByte(priority);
   properties.encode(buffer);
 }