use of com.ms.silverking.cloud.dht.net.MessageGroupKeyOrdinalEntry in project SilverKing by Morgan-Stanley.
the class ActiveProxyPut method handlePutResponse.
// ///////////////////
// handle responses
/**
* Process a put response according to the protocol in use by this StorageOperation.
*
* @param message
* @param _connection
* @return
*/
OpResult handlePutResponse(MessageGroup message, MessageGroupConnectionProxy _connection) {
PutCommunicator pComm;
byte storageState;
pComm = new PutCommunicator(this);
if (debug) {
System.out.println("handlePutResponse");
}
storageState = ProtoPutResponseMessageGroup.getStorageState(message);
for (MessageGroupKeyOrdinalEntry entry : message.getKeyOrdinalIterator()) {
IPAndPort replica;
replica = new IPAndPort(message.getOriginator(), DHTNode.getServerPort());
if (debug) {
System.out.println("replica: " + replica);
}
storageOperation.update(entry.getKey(), replica, storageState, EnumValues.opResult[entry.getOrdinal()], pComm);
}
// forward state updates
Map<IPAndPort, List<MessageGroupKeyOrdinalEntry>> rumLists;
rumLists = pComm.takeReplicaUpdateMessageLists();
if (rumLists.size() > 0) {
forwardGroupedEntries(rumLists, optionsByteBuffer, new PutUpdateForwardCreator(storageOperation.nextStorageState(storageState)), pComm);
}
// send responses for completions
messageModule.sendPutResults(message, version, connection, pComm.takeResults(), storageState, message.getDeadlineRelativeMillis());
return storageOperation.getOpResult();
}
Aggregations