/// <summary> /// Concurrently gets or creates a <see cref="RcSummary"/> for given activation and request. /// </summary> public void CreateAndStartSummary <T>(object activationKey, IAddressable target, InvokeMethodRequest request, IGrainMethodInvoker invoker, Message message, bool refresh) { RcSummaryBase RcSummary; var SummaryMap = GetCurrentSummaryMap(); var SummaryKey = GetMethodAndArgsKey(request); var Timeout = Config.ReactiveComputationRefresh.Multiply(3); var NewRcSummary = new RcSummary <T>(activationKey, request, target, invoker, Timeout, this); var threadSafeRetrieval = false; bool existed; // We need to retrieve the summary and add the dependency under the lock of the summary // in order to prevent interleaving with removal of the summary from the SummaryMap. do { RcSummary = SummaryMap.GetOrAdd(SummaryKey, NewRcSummary); existed = RcSummary != NewRcSummary; threadSafeRetrieval = ((RcSummary)RcSummary).AddPushDependency(message, refresh); } while (!threadSafeRetrieval); if (!existed) { NewRcSummary.Initialize(); NewRcSummary.EnqueueExecution(); } IsPropagator = true; }
public PushDependency(string pushKey, RcSummary summary, IRcManager observer, TimeSpan interval) { Observer = observer; PushKey = pushKey; }