public long serializedSize(GossipDigestAck ack, int version) {
   int size = GossipDigestSerializationHelper.serializedSize(ack.gDigestList, version);
   if (version <= MessagingService.VERSION_11) size += TypeSizes.NATIVE.sizeof(true);
   size += TypeSizes.NATIVE.sizeof(ack.epStateMap.size());
   for (Map.Entry<InetAddress, EndpointState> entry : ack.epStateMap.entrySet())
     size +=
         CompactEndpointSerializationHelper.serializedSize(entry.getKey())
             + EndpointState.serializer.serializedSize(entry.getValue(), version);
   return size;
 }
 public void serialize(GossipDigestAck gDigestAckMessage, DataOutput dos, int version)
     throws IOException {
   GossipDigestSerializationHelper.serialize(gDigestAckMessage.gDigestList, dos, version);
   if (version <= MessagingService.VERSION_11) dos.writeBoolean(true); // 0.6 compatibility
   dos.writeInt(gDigestAckMessage.epStateMap.size());
   for (Map.Entry<InetAddress, EndpointState> entry : gDigestAckMessage.epStateMap.entrySet()) {
     InetAddress ep = entry.getKey();
     CompactEndpointSerializationHelper.serialize(ep, dos);
     EndpointState.serializer.serialize(entry.getValue(), dos, version);
   }
 }
  public GossipDigestAck deserialize(DataInput dis, int version) throws IOException {
    List<GossipDigest> gDigestList = GossipDigestSerializationHelper.deserialize(dis, version);
    if (version <= MessagingService.VERSION_11) dis.readBoolean(); // 0.6 compatibility
    int size = dis.readInt();
    Map<InetAddress, EndpointState> epStateMap = new HashMap<InetAddress, EndpointState>(size);

    for (int i = 0; i < size; ++i) {
      InetAddress ep = CompactEndpointSerializationHelper.deserialize(dis);
      EndpointState epState = EndpointState.serializer.deserialize(dis, version);
      epStateMap.put(ep, epState);
    }
    return new GossipDigestAck(gDigestList, epStateMap);
  }
 public GossipDigestAckMessage deserialize(DataInputStream dis) throws IOException {
   List<GossipDigest> gDigestList = GossipDigestSerializationHelper.deserialize(dis);
   dis.readBoolean(); // 0.6 compatibility
   Map<InetAddress, EndpointState> epStateMap = EndpointStatesSerializationHelper.deserialize(dis);
   return new GossipDigestAckMessage(gDigestList, epStateMap);
 }
 public void serialize(GossipDigestAckMessage gDigestAckMessage, DataOutputStream dos)
     throws IOException {
   GossipDigestSerializationHelper.serialize(gDigestAckMessage.gDigestList_, dos);
   dos.writeBoolean(true); // 0.6 compatibility
   EndpointStatesSerializationHelper.serialize(gDigestAckMessage.epStateMap_, dos);
 }
Ejemplo n.º 6
0
 public GossipDigestSynMessage deserialize(DataInputStream dis) throws IOException {
   String clusterId = dis.readUTF();
   List<GossipDigest> gDigests = GossipDigestSerializationHelper.deserialize(dis);
   return new GossipDigestSynMessage(clusterId, gDigests);
 }
Ejemplo n.º 7
0
 public void serialize(GossipDigestSynMessage gDigestSynMessage, DataOutputStream dos)
     throws IOException {
   dos.writeUTF(gDigestSynMessage.clusterId_);
   GossipDigestSerializationHelper.serialize(gDigestSynMessage.gDigests_, dos);
 }