public override Task <IMethodEntityWithPropagator> GetMethodEntityAsync(MethodDescriptor methodDescriptor)
        {
//#if COMPUTE_STATS
            // this.MethodDescriptors.Add(methodDescriptor);
//#endif
            var methodEntityGrain = OrleansMethodEntity.GetMethodEntityGrain(grainFactory, methodDescriptor);

            return(Task.FromResult <IMethodEntityWithPropagator>(methodEntityGrain));
        }
Example #2
0
        private Task <IMethodEntityGrain> GetMethodEntityGrainAndActivateInProject(MethodDescriptor method)
        {
            var methodEntityGrain = OrleansMethodEntity.GetMethodEntityGrain(this.grainFactory, method);

            return(Task.FromResult(methodEntityGrain));

            //var methodEntityProc = await this.solutionManager.GetMethodEntityAsync(method); //as IMethodEntityGrain;
            //// Force MethodGrain placement near projects
            ////var codeProvider = await this.solutionManager.GetProjectCodeProviderAsync(method);
            ////var methodEntityProc = await codeProvider.GetMethodEntityAsync(method) as IMethodEntityGrain;
            //return methodEntityProc as IMethodEntityGrain;
        }
        public async Task ForceDeactivationOfMethodEntitiesAsync()
        {
            var tasks = new List <Task>();

            foreach (var methodDescriptor in reachableMethods)
            {
                var methodEntityGrain = OrleansMethodEntity.GetMethodEntityGrain(grainFactory, methodDescriptor);
                var task = methodEntityGrain.ForceDeactivationAsync();
                //await task;
                tasks.Add(task);
            }

            await Task.WhenAll(tasks);
        }
        public override async Task ReloadAsync()
        {
            var tasks = new List <Task>();

            // TODO: maybe we should only deactivate methods that are reachable (i.e. have a MethodEntityGrain created for them)
            // all reachable methods are stored in the reachableMethods set
            foreach (var methodDescriptor in methodsToRemove)
            {
                var methodEntityGrain = OrleansMethodEntity.GetMethodEntityGrain(grainFactory, methodDescriptor);
                var task = methodEntityGrain.ForceDeactivationAsync();
                //await task;
                tasks.Add(task);

                // TODO: maybe we should also need to remove the method from the reachableMethods set
            }

            methodsToRemove.Clear();

            await Task.WhenAll(tasks);

            await base.ReloadAsync();
        }
        public override Task <IMethodEntityWithPropagator> GetMethodEntityAsync(MethodDescriptor methodDescriptor)
        {
            var methodEntityGrain = OrleansMethodEntity.GetMethodEntityGrain(grainFactory, methodDescriptor);

            return(Task.FromResult <IMethodEntityWithPropagator>(methodEntityGrain));
        }