use of com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup in project SilverKing by Morgan-Stanley.
the class AsyncRetrievalOperationImpl method retrieveSegments.
private void retrieveSegments(DHTKey relayKey, DHTKey[] segmentKeys, MetaData metaData) {
List<MessageGroup> messageGroups;
SegmentedRetrievalValue<K, V> segmentedRetrievalValue;
if (segmentedRetrievalValues == null) {
segmentedRetrievalValues = new ArrayList<>(segmentKeys.length);
}
segmentedRetrievalValue = new SegmentedRetrievalValue<>(segmentKeys, relayKey, this, nspoImpl.getValueDeserializer(), metaData);
messageGroups = new ArrayList<>();
for (DHTKey segmentKey : segmentKeys) {
ProtoRetrievalMessageGroup protoRetrievalMG;
boolean listenerInserted;
List<WeakReference<ActiveKeyedOperationResultListener<MessageGroupRetrievalResponseEntry>>> listeners;
protoRetrievalMG = createProtoRetrievalMG(new KeyedMessageEstimate(1), false);
listenerInserted = activeRetrievalListeners.addListener(protoRetrievalMG.getUUID(), segmentKey, segmentedRetrievalValue);
if (!listenerInserted) {
throw new RuntimeException("Duplicate listener insertion");
}
protoRetrievalMG.addKey(segmentKey);
protoRetrievalMG.addToMessageGroupList(messageGroups);
// hold a reference to the uuid to prevent GC
opUUIDs.add((OperationUUID) protoRetrievalMG.getUUID());
segmentedRetrievalValues.add(segmentedRetrievalValue);
}
for (MessageGroup messageGroup : messageGroups) {
retrievalSender.send(messageGroup);
}
}
use of com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup in project SilverKing by Morgan-Stanley.
the class AsyncRetrievalOperationImpl method createProtoRetrievalMG.
private ProtoRetrievalMessageGroup createProtoRetrievalMG(MessageEstimate estimate, boolean verifyIntegrity) {
OperationUUID opUUID;
ConcurrentMap<DHTKey, List<ActiveKeyedOperationResultListener<MessageGroupRetrievalResponseEntry>>> newMap;
KeyedMessageEstimate keyedMessageEstimate;
int relDeadline;
keyedMessageEstimate = (KeyedMessageEstimate) estimate;
opUUID = activeRetrievalListeners.newOpUUID();
relDeadline = operation.getTimeoutController().getMaxRelativeTimeoutMillis(this);
if (debugShortTimeout) {
if (relDeadline < shortTimeoutLimit) {
Log.warning("short relDeadline: " + relDeadline);
// Log.warning(timeoutParameters.computeTimeout(keyedMessageEstimate.getNumKeys()));
Log.warning(timeoutState.getCurRelTimeoutMillis());
// throw new RuntimeException();
}
}
return new ProtoRetrievalMessageGroup(opUUID, context.contextAsLong(), new InternalRetrievalOptions(retrievalOperation.retrievalOptions(), verifyIntegrity), originator, keyedMessageEstimate.getNumKeys(), relDeadline, retrievalOperation.retrievalOptions().getForwardingMode());
}
use of com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup in project SilverKing by Morgan-Stanley.
the class AsyncRetrievalOperationImpl method handleCorruptValue.
private void handleCorruptValue(DHTKey key) {
ProtoRetrievalMessageGroup protoRetrievalMG;
boolean listenerInserted;
protoRetrievalMG = createProtoRetrievalMG(new KeyedMessageEstimate(1), true);
listenerInserted = activeRetrievalListeners.addListener(protoRetrievalMG.getUUID(), key, this);
if (!listenerInserted) {
throw new RuntimeException("Duplicate listener insertion");
}
protoRetrievalMG.addKey(key);
// hold a reference to the uuid to prevent GC
opUUIDs.add((OperationUUID) protoRetrievalMG.getUUID());
retrievalSender.send(protoRetrievalMG.toMessageGroup());
}
use of com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup in project SilverKing by Morgan-Stanley.
the class ActiveRegionSync method sendSyncRetrievalRequest.
private void sendSyncRetrievalRequest(SyncRetrievalRequest srr) {
MessageGroup mg;
RetrievalOptions retrievalOptions;
Log.warningAsyncf("ars %s send srr %s", uuid, srr.getUUID());
inprocessSyncRetrievalRequests.add(srr.getUUID());
retrievalOptions = OptionsHelper.newRetrievalOptions(RetrievalType.VALUE_AND_META_DATA, WaitMode.GET, checksumVersionConstraint(srr.dataVersion));
mg = new ProtoRetrievalMessageGroup(srr.uuid, namespace, new InternalRetrievalOptions(retrievalOptions), mgBase.getMyID(), srr.outstandingKeys, convergenceRelativeDeadlineMillis).toMessageGroup();
// outgoingMessages.add(new OutgoingMessage(mg, new IPAndPort(srr.connection.getRemoteSocketAddress())));
mgBase.send(mg, srr.connection.getRemoteIPAndPort());
}
use of com.ms.silverking.cloud.dht.net.ProtoRetrievalMessageGroup in project SilverKing by Morgan-Stanley.
the class ConvergenceController2 method sendSyncRetrievalRequest.
private void sendSyncRetrievalRequest(SyncRetrievalRequest srr) {
MessageGroup mg;
RetrievalOptions retrievalOptions;
retrievalOptions = OptionsHelper.newRetrievalOptions(RetrievalType.VALUE_AND_META_DATA, WaitMode.GET, checksumVersionConstraint(srr.dataVersion));
mg = new ProtoRetrievalMessageGroup(srr.uuid, ns, new InternalRetrievalOptions(retrievalOptions), mgBase.getMyID(), srr.outstandingKeys, convergenceRelativeDeadlineMillis).toMessageGroup();
outgoingMessages.add(new OutgoingMessage(mg, new IPAndPort(srr.connection.getRemoteSocketAddress())));
}
Aggregations