{
private static Logger logger_ = Logger.getLogger(GossipDigestAckVerbHandler.class);
public void doVerb(Message message)
{
EndPoint from = message.getFrom();
logger_.trace("Received a GossipDigestAckMessage from " + from);
byte[] bytes = (byte[])message.getMessageBody()[0];
DataInputStream dis = new DataInputStream( new ByteArrayInputStream(bytes) );
try
{
GossipDigestAckMessage gDigestAckMessage = GossipDigestAckMessage.serializer().deserialize(dis);
List<GossipDigest> gDigestList = gDigestAckMessage.getGossipDigestList();
Map<EndPoint, EndPointState> epStateMap = gDigestAckMessage.getEndPointStateMap();
if ( epStateMap.size() > 0 )
{
/* Notify the Failure Detector */
Gossiper.instance().notifyFailureDetector(epStateMap);
Gossiper.instance().applyStateLocally(epStateMap);
}
/* Get the state required to send to this gossipee - construct GossipDigestAck2Message */
Map<EndPoint, EndPointState> deltaEpStateMap = new HashMap<EndPoint, EndPointState>();
for( GossipDigest gDigest : gDigestList )
{
EndPoint addr = gDigest.getEndPoint();
EndPointState localEpStatePtr = Gossiper.instance().getStateForVersionBiggerThan(addr, gDigest.getMaxVersion());
if ( localEpStatePtr != null )
deltaEpStateMap.put(addr, localEpStatePtr);
}