Ejemplo n.º 1
0
        /// <summary>
        /// This method "replaces" the send + dispatch + processReturnMessage for calless that used the methodProcessor and dispatcher
        /// The idea is trying to avoid reentrant calls to grains
        /// We wil need to improve the code / design but this is a first approach to solve that problem
        /// </summary>
        /// <param name="caller"></param>
        /// <param name="calleeMessage"></param>
        /// <param name="propKind"></param>
        /// <returns></returns>
        private async Task AnalyzeReturnAsync(MethodDescriptor caller, CalleeMessage calleeMessage, PropagationKind propKind)
        {
            Logger.LogS("AnalysisOrchestator", "AnalyzeReturnAsync", "Analyzing return to {0} ", caller);

            var methodEntityProc = await GetMethodEntityGrainAndActivateInProject(caller);

            var exit = false;

            for (int i = 0; i < 3 && !exit; i++)
            {
                try
                {
                    exit = true;
                    await methodEntityProc.PropagateAndProcessAsync(calleeMessage.ReturnMessageInfo);
                }
                catch //(Exception e)
                {
                    exit = false;
                }
            }
            //var methodEntityProc = await this.solutionManager.GetMethodEntityAsync(caller) as IMethodEntityGrain;
            //var propagationEffects = await methodEntityProc.PropagateAsync(calleeMessage.ReturnMessageInfo);
            //await this.PropagateEffectsAsync(propagationEffects, propKind, methodEntityProc);
            Logger.LogS("AnalysisOrchestator", "AnalyzeReturnAsync", "End Analyzing return to {0} ", caller);
        }
Ejemplo n.º 2
0
        private Task CreateAndSendReturnMessageAsync(ReturnInfo returnInfo, PropagationKind propKind)
        {
            var returnMessageInfo = new ReturnMessageInfo(returnInfo.CallerContext.Caller, returnInfo.Callee, returnInfo.ResultPossibleTypes,
                                                          returnInfo.CallerContext.CallNode, returnInfo.CallerContext.LHS, propKind);

            var source        = new MethodEntityDescriptor(returnInfo.Callee);
            var calleeMessage = new CalleeMessage(source, returnMessageInfo);

            return(this.AnalyzeReturnAsync(returnMessageInfo.Caller, calleeMessage, propKind));
        }
Ejemplo n.º 3
0
        private async Task AnalyzeReturnAsync(MethodDescriptor caller, CalleeMessage calleeMessage, PropagationKind propKind)
        {
            Logger.LogS("EffectsDispatcherManager", "AnalyzeReturn", "Analyzing return to {0} ", caller);

            //var methodEntityProc = await this.solutionManager.GetMethodEntityAsync(caller);
            var methodEntityProc = await this.GetMethodEntityGrainAndActivateInProject(caller);

            await methodEntityProc.PropagateAndProcessAsync(calleeMessage.ReturnMessageInfo);

            Logger.LogS("EffectsDispatcherManager", "AnalyzeReturn", "End Analyzing return to {0} ", caller);
        }
        private Task CreateAndSendReturnMessageAsync(ReturnInfo returnInfo, PropagationKind propKind)
        {
            var returnMessageInfo = new ReturnMessageInfo(returnInfo.CallerContext.Caller, returnInfo.Callee, returnInfo.ResultPossibleTypes,
                                                          returnInfo.CallerContext.CallNode, returnInfo.CallerContext.LHS, propKind);

            var source        = new MethodEntityDescriptor(returnInfo.Callee);
            var calleeMessage = new CalleeMessage(source, returnMessageInfo);

            //await WaitQueue(QUEUE_THRESHOLD);
            this.messageWorkList.Enqueue(calleeMessage);
            //this.messageWorkList.Add(calleeMessage);

            return(Task.CompletedTask);
            //return AnalyzeReturnAsync(returnMessageInfo.Caller, calleeMessage, propKind);
        }
Ejemplo n.º 5
0
        private async Task CreateAndSendReturnMessageAsync(ReturnInfo returnInfo, PropagationKind propKind)
        {
            var returnMessageInfo = new ReturnMessageInfo(returnInfo.CallerContext.Caller, returnInfo.Callee, returnInfo.ResultPossibleTypes,
                                                          returnInfo.CallerContext.CallNode, returnInfo.CallerContext.LHS, propKind);

            var source        = new MethodEntityDescriptor(returnInfo.Callee);
            var calleeMessage = new CalleeMessage(source, returnMessageInfo);

            await this.solutionManager.UpdateCounter(1);

            //await WaitQueue(QUEUE_THRESHOLD);
            this.messageWorkList.Enqueue(calleeMessage);
            //this.messageWorkList.Add(calleeMessage);

            //return TaskDone.Done;
        }