Exemplo n.º 1
0
 public ActivationDataActivatorProvider(
     GrainClassMap grainClassMap,
     IServiceProvider serviceProvider,
     PlacementStrategyResolver placementStrategyResolver,
     IActivationCollector activationCollector,
     IClusterManifestProvider clusterManifestProvider,
     IOptions <SiloMessagingOptions> messagingOptions,
     IOptions <GrainCollectionOptions> collectionOptions,
     ILoggerFactory loggerFactory,
     GrainReferenceActivator grainReferenceActivator,
     GrainTypeComponentsResolver sharedComponentsResolver)
 {
     _sharedComponentsResolver  = sharedComponentsResolver;
     _grainClassMap             = grainClassMap;
     _serviceProvider           = serviceProvider;
     _placementStrategyResolver = placementStrategyResolver;
     _activationCollector       = activationCollector;
     _siloManifest      = clusterManifestProvider.LocalGrainManifest;
     _collectionOptions = collectionOptions.Value;
     _messagingOptions  = messagingOptions;
     _maxWarningRequestProcessingTime = messagingOptions.Value.ResponseTimeout.Multiply(5);
     _maxRequestProcessingTime        = messagingOptions.Value.MaxRequestProcessingTime;
     _loggerFactory           = loggerFactory;
     _grainReferenceActivator = grainReferenceActivator;
 }
Exemplo n.º 2
0
        public ActivationData(
            ActivationAddress addr,
            PlacementStrategy placedUsing,
            IActivationCollector collector,
            TimeSpan ageLimit,
            IOptions <SiloMessagingOptions> messagingOptions,
            TimeSpan maxWarningRequestProcessingTime,
            TimeSpan maxRequestProcessingTime,
            ILoggerFactory loggerFactory,
            IServiceProvider applicationServices,
            IGrainRuntime grainRuntime,
            GrainReferenceActivator referenceActivator,
            GrainTypeComponents sharedComponents,
            ActivationMessageScheduler messageScheduler)
        {
            if (null == addr)
            {
                throw new ArgumentNullException(nameof(addr));
            }
            if (null == placedUsing)
            {
                throw new ArgumentNullException(nameof(placedUsing));
            }
            if (null == collector)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            _receiveMessageInScheduler = state => this.ReceiveMessageInScheduler(state);
            _shared                              = sharedComponents;
            _messageScheduler                    = messageScheduler;
            logger                               = loggerFactory.CreateLogger <ActivationData>();
            this.lifecycle                       = new GrainLifecycle(loggerFactory.CreateLogger <LifecycleSubject>());
            this.maxRequestProcessingTime        = maxRequestProcessingTime;
            this.maxWarningRequestProcessingTime = maxWarningRequestProcessingTime;
            this.messagingOptions                = messagingOptions.Value;
            ResetKeepAliveRequest();
            Address     = addr;
            State       = ActivationState.Create;
            PlacedUsing = placedUsing;
            if (!this.GrainId.IsSystemTarget())
            {
                this.collector = collector;
            }

            CollectionAgeLimit = ageLimit;

            this.GrainReference = referenceActivator.CreateReference(addr.Grain, default);
            this.serviceScope   = applicationServices.CreateScope();
            this.Runtime        = grainRuntime;
        }
Exemplo n.º 3
0
        public ActivationData(
            ActivationAddress addr,
            string genericArguments,
            PlacementStrategy placedUsing,
            IMultiClusterRegistrationStrategy registrationStrategy,
            IActivationCollector collector,
            TimeSpan ageLimit,
            IOptions <SiloMessagingOptions> messagingOptions,
            TimeSpan maxWarningRequestProcessingTime,
            TimeSpan maxRequestProcessingTime,
            IRuntimeClient runtimeClient,
            ILoggerFactory loggerFactory)
        {
            if (null == addr)
            {
                throw new ArgumentNullException(nameof(addr));
            }
            if (null == placedUsing)
            {
                throw new ArgumentNullException(nameof(placedUsing));
            }
            if (null == collector)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            logger         = loggerFactory.CreateLogger <ActivationData>();
            this.lifecycle = new GrainLifecycle(loggerFactory.CreateLogger <LifecycleSubject>());
            this.maxRequestProcessingTime        = maxRequestProcessingTime;
            this.maxWarningRequestProcessingTime = maxWarningRequestProcessingTime;
            this.messagingOptions = messagingOptions.Value;
            ResetKeepAliveRequest();
            Address              = addr;
            State                = ActivationState.Create;
            PlacedUsing          = placedUsing;
            RegistrationStrategy = registrationStrategy;
            if (!Grain.IsSystemTarget)
            {
                this.collector = collector;
            }

            CollectionAgeLimit = ageLimit;

            GrainReference         = GrainReference.FromGrainId(addr.Grain, runtimeClient.GrainReferenceRuntime, genericArguments, Grain.IsSystemTarget ? addr.Silo : null);
            this.SchedulingContext = new SchedulingContext(this);
        }
Exemplo n.º 4
0
        public ActivationData(
            ActivationAddress addr,
            string genericArguments,
            PlacementStrategy placedUsing,
            IMultiClusterRegistrationStrategy registrationStrategy,
            IActivationCollector collector,
            TimeSpan ageLimit,
            NodeConfiguration nodeConfiguration,
            TimeSpan maxWarningRequestProcessingTime,
            TimeSpan maxRequestProcessingTime,
            IRuntimeClient runtimeClient)
        {
            if (null == addr)
            {
                throw new ArgumentNullException(nameof(addr));
            }
            if (null == placedUsing)
            {
                throw new ArgumentNullException(nameof(placedUsing));
            }
            if (null == collector)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            logger         = LogManager.GetLogger("ActivationData", LoggerType.Runtime);
            this.lifecycle = new GrainLifecycle(logger);
            this.maxRequestProcessingTime        = maxRequestProcessingTime;
            this.maxWarningRequestProcessingTime = maxWarningRequestProcessingTime;
            this.nodeConfiguration = nodeConfiguration;
            ResetKeepAliveRequest();
            Address              = addr;
            State                = ActivationState.Create;
            PlacedUsing          = placedUsing;
            RegistrationStrategy = registrationStrategy;
            if (!Grain.IsSystemTarget && !Constants.IsSystemGrain(Grain))
            {
                this.collector = collector;
            }
            CollectionAgeLimit = ageLimit;

            GrainReference         = GrainReference.FromGrainId(addr.Grain, runtimeClient.GrainReferenceRuntime, genericArguments, Grain.IsSystemTarget ? addr.Silo : null);
            this.SchedulingContext = new SchedulingContext(this);
        }
Exemplo n.º 5
0
        public ActivationData(
            ActivationAddress addr,
            string genericArguments,
            PlacementStrategy placedUsing,
            MultiClusterRegistrationStrategy registrationStrategy,
            IActivationCollector collector,
            TimeSpan ageLimit,
            NodeConfiguration nodeConfiguration,
            TimeSpan maxRequestProcessingTime)
        {
            if (null == addr)
            {
                throw new ArgumentNullException("addr");
            }
            if (null == placedUsing)
            {
                throw new ArgumentNullException("placedUsing");
            }
            if (null == collector)
            {
                throw new ArgumentNullException("collector");
            }

            logger = LogManager.GetLogger("ActivationData", LoggerType.Runtime);
            this.maxRequestProcessingTime = maxRequestProcessingTime;
            this.nodeConfiguration        = nodeConfiguration;
            ResetKeepAliveRequest();
            Address              = addr;
            State                = ActivationState.Create;
            PlacedUsing          = placedUsing;
            RegistrationStrategy = registrationStrategy;
            if (!Grain.IsSystemTarget && !Constants.IsSystemGrain(Grain))
            {
                this.collector = collector;
            }
            CollectionAgeLimit = ageLimit;


            GrainReference = GrainReference.FromGrainId(addr.Grain, genericArguments, Grain.IsSystemTarget ? addr.Silo : null);
        }
Exemplo n.º 6
0
        public ActivationData(ActivationAddress addr, string genericArguments, PlacementStrategy placedUsing, IActivationCollector collector, TimeSpan ageLimit)
        {
            if (null == addr)
            {
                throw new ArgumentNullException("addr");
            }
            if (null == placedUsing)
            {
                throw new ArgumentNullException("placedUsing");
            }
            if (null == collector)
            {
                throw new ArgumentNullException("collector");
            }

            logger = TraceLogger.GetLogger("ActivationData", TraceLogger.LoggerType.Runtime);
            ResetKeepAliveRequest();
            Address     = addr;
            State       = ActivationState.Create;
            PlacedUsing = placedUsing;

            if (!Grain.IsSystemTarget && !Constants.IsSystemGrain(Grain))
            {
                this.collector = collector;
            }
            CollectionAgeLimit = ageLimit;

            GrainReference = GrainReference.FromGrainId(addr.Grain, genericArguments,
                                                        Grain.IsSystemTarget ? addr.Silo : null);
        }
Exemplo n.º 7
0
        public ActivationData(ActivationAddress addr, string genericArguments, PlacementStrategy placedUsing, MultiClusterRegistrationStrategy registrationStrategy, IActivationCollector collector, TimeSpan ageLimit)
        {
            if (null == addr) throw new ArgumentNullException("addr");
            if (null == placedUsing) throw new ArgumentNullException("placedUsing");
            if (null == collector) throw new ArgumentNullException("collector");

            logger = LogManager.GetLogger("ActivationData", LoggerType.Runtime);
            ResetKeepAliveRequest();
            Address = addr;
            State = ActivationState.Create;
            PlacedUsing = placedUsing;
            RegistrationStrategy = registrationStrategy;
            if (!Grain.IsSystemTarget && !Constants.IsSystemGrain(Grain))
            {
                this.collector = collector;
            }
            CollectionAgeLimit = ageLimit;

            GrainReference = GrainReference.FromGrainId(addr.Grain, genericArguments,
                Grain.IsSystemTarget ? addr.Silo : null);
        }