use of com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult in project SilverKing by Morgan-Stanley.
the class ActiveProxyRetrieval method handleRetrievalResponse.
// ///////////////////
// Handle responses
public OpResult handleRetrievalResponse(MessageGroup message, MessageGroupConnectionProxy connection) {
RetrievalCommunicator rComm;
Map<IPAndPort, List<DHTKey>> destEntryMap;
OpResult opResult;
rComm = new RetrievalCommunicator();
if (debug) {
System.out.println("handleRetrievalResponse");
}
for (MessageGroupRetrievalResponseEntry entry : message.getRetrievalResponseValueKeyIterator()) {
IPAndPort replica;
replica = new IPAndPort(message.getOriginator(), DHTNode.getServerPort());
if (debug) {
System.out.println("replica: " + replica);
}
retrievalOperation.update(entry, replica, new RetrievalResult(entry, entry.getOpResult(), entry.getValue()), rComm);
}
sendResults(rComm);
destEntryMap = rComm.takeReplicaMessageLists();
if (destEntryMap != null) {
forwardGroupedEntries(destEntryMap, optionsByteBuffer, new RetrievalForwardCreator(), rComm);
}
if (retrievalOptions.getRetrievalOptions().getUpdateSecondariesOnMiss()) {
if (debug) {
Log.warning("ActiveProxyRetrieval calling sendSecondaryReplicasUpdates");
}
sendSecondaryReplicasUpdates(rComm);
} else {
if (debug) {
Log.warning("ActiveProxyRetrieval *no* sendSecondaryReplicasUpdates");
}
}
return retrievalOperation.getOpResult();
}
Aggregations