Search in sources :

Example 1 with RetrievalCommunicator

use of com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator in project SilverKing by Morgan-Stanley.

the class ActiveProxyRetrieval method startOperation.

// protected OpVirtualCommunicator<DHTKey,RetrievalResult> createCommunicator() {
// return new RetrievalCommunicator();
// }
void startOperation() {
    if (forwardingMode.forwards()) {
        messageModule.addActiveRetrieval(uuid, this);
    } else {
        if (retrievalOptions.getWaitMode() == WaitMode.WAIT_FOR) {
            messageModule.addActiveRetrieval(uuid, this);
        }
    }
    rComm = new RetrievalCommunicator();
    super.startOperation(rComm, message.getKeyIterator(), new RetrievalForwardCreator());
// message = null; // free payload for GC
}
Also used : RetrievalCommunicator(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator)

Example 2 with RetrievalCommunicator

use of com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator in project SilverKing by Morgan-Stanley.

the class ActiveProxyRetrieval method checkForReplicaTimeouts.

// ////////////////////
public Set<IPAndPort> checkForReplicaTimeouts(long curTimeMillis) {
    RetrievalCommunicator rComm;
    Map<IPAndPort, List<DHTKey>> destEntryMap;
    Set<IPAndPort> timedOutReplicas;
    if (debug) {
        System.out.println("checkForReplicaTimeouts " + uuid + " " + getOpResult());
    }
    timedOutReplicas = new HashSet<>();
    rComm = new RetrievalCommunicator();
    timedOutReplicas.addAll(retrievalOperation.checkForInternalTimeouts(curTimeMillis, rComm));
    destEntryMap = rComm.takeReplicaMessageLists();
    if (destEntryMap != null) {
        if (debug) {
            System.out.println("forwardGroupedEntries");
        }
        forwardGroupedEntries(destEntryMap, optionsByteBuffer, new RetrievalForwardCreator(), rComm);
    }
    return timedOutReplicas;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RetrievalCommunicator(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List)

Example 3 with RetrievalCommunicator

use of com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator 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();
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) OpResult(com.ms.silverking.cloud.dht.common.OpResult) RetrievalCommunicator(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) MessageGroupRetrievalResponseEntry(com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry) RetrievalResult(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult)

Aggregations

RetrievalCommunicator (com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalCommunicator)3 ImmutableList (com.google.common.collect.ImmutableList)2 IPAndPort (com.ms.silverking.net.IPAndPort)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 OpResult (com.ms.silverking.cloud.dht.common.OpResult)1 RetrievalResult (com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult)1 MessageGroupRetrievalResponseEntry (com.ms.silverking.cloud.dht.net.MessageGroupRetrievalResponseEntry)1