Exemplo n.º 1
0
        private Task CreateAndSendCallMessageAsync(CallInfo callInfo, ResolvedCallee callee, PropagationKind propKind)
        {
            var callMessageInfo = new CallMessageInfo(callInfo.Caller, callee.Method, callee.ReceiverType,
                                                      callInfo.ArgumentsPossibleTypes, callInfo.CallNode, callInfo.LHS, propKind);

            var source        = new MethodEntityDescriptor(callInfo.Caller);
            var callerMessage = new CallerMessage(source, callMessageInfo);

            return(this.AnalyzeCalleeAsync(callMessageInfo.Callee, callerMessage, propKind));
        }
Exemplo n.º 2
0
        private async Task AnalyzeCalleeAsync(MethodDescriptor callee, CallerMessage callerMessage, PropagationKind propKind)
        {
            Logger.LogS("EffectsDispatcherManager", "AnalyzeCallee", "Analyzing: {0}", callee);

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

            await methodEntityProc.PropagateAndProcessAsync(callerMessage.CallMessageInfo);

            Logger.LogS("EffectsDispatcherManager", "AnalyzeCallee", "End Analyzing call to {0} ", callee);
        }
        /// <summary>
        /// This method "replaces" the send + dispatch + processCallMessage 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="callee"></param>
        /// <param name="callerMessage"></param>
        /// <param name="propKind"></param>
        /// <returns></returns>
        private async Task AnalyzeCalleeAsync(MethodDescriptor callee, CallerMessage callerMessage, PropagationKind propKind)
        {
            if (GrainClient.IsInitialized)
            {
                Logger.LogInfo(GrainClient.Logger, "Orchestrator", "AnalyzeCalleeAsync", "Analyzing: {0}", callee);
            }

            //Logger.LogS("AnalysisOrchestator", "AnalyzeCalleeAsync", "Analyzing call to {0} ", callee);

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

            //PropagationEffects propagationEffects = null;
            //var ready = true;
            //
            //do
            //{
            //	propagationEffects = await methodEntityProc.PropagateAsync(callerMessage.CallMessageInfo);
            //	ready = await WaitForReady(propagationEffects,callee);
            //}
            //while (!ready);
            //
            //await this.PropagateEffectsAsync(propagationEffects, propKind, methodEntityProc);

            var exit = false;

            for (int i = 0; i < 3 && !exit; i++)
            {
                try
                {
                    exit = true;
                    //await methodEntityProc.PropagateAndProcessAsync(callerMessage.CallMessageInfo);
                    var propagationEffects = await methodEntityProc.PropagateAsync(callerMessage.CallMessageInfo);

                    await this.PropagateEffectsAsync(propagationEffects, propKind, methodEntityProc);
                }
                catch                 //(Exception e)
                {
                    exit = false;
                }
            }
            //var propagationEffects = await methodEntityProc.PropagateAsync(callerMessage.CallMessageInfo);
            //await this.PropagateEffectsAsync(propagationEffects, propKind, methodEntityProc);

            Logger.LogS("AnalysisOrchestator", "AnalyzeCalleeAsync", "End Analyzing call to {0} ", callee);
        }
        private Task CreateAndSendCallMessageAsync(CallInfo callInfo, ResolvedCallee callee, PropagationKind propKind)
        {
            var callMessageInfo = new CallMessageInfo(callInfo.Caller, callee.Method, callee.ReceiverType,
                                                      callInfo.ArgumentsPossibleTypes, callInfo.CallNode, callInfo.LHS, propKind);

            var source        = new MethodEntityDescriptor(callInfo.Caller);
            var callerMessage = new CallerMessage(source, callMessageInfo);

            //Logger.LogWarning(GrainClient.Logger, "Orchestrator", "CreateAndSendCallMsg", "Enqueuing: {0}", callee);

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

            return(Task.CompletedTask);
            //return AnalyzeCalleeAsync(callMessageInfo.Callee, callerMessage, propKind);
        }