public ActivationDataActivatorProvider(
     GrainClassMap grainClassMap,
     IServiceProvider serviceProvider,
     ILoggerFactory loggerFactory,
     GrainReferenceActivator grainReferenceActivator,
     GrainTypeSharedContextResolver sharedComponentsResolver,
     IActivationWorkingSet activationWorkingSet,
     ILogger <WorkItemGroup> workItemGroupLogger,
     ILogger <ActivationTaskScheduler> activationTaskSchedulerLogger,
     SchedulerStatisticsGroup schedulerStatisticsGroup,
     IOptions <SchedulingOptions> schedulingOptions,
     IOptions <StatisticsOptions> statisticsOptions)
 {
     _activationWorkingSet          = activationWorkingSet;
     _workItemGroupLogger           = workItemGroupLogger;
     _activationTaskSchedulerLogger = activationTaskSchedulerLogger;
     _schedulerStatisticsGroup      = schedulerStatisticsGroup;
     _schedulingOptions             = schedulingOptions;
     _statisticsOptions             = statisticsOptions;
     _sharedComponentsResolver      = sharedComponentsResolver;
     _grainClassMap           = grainClassMap;
     _serviceProvider         = serviceProvider;
     _loggerFactory           = loggerFactory;
     _grainReferenceActivator = grainReferenceActivator;
 }
Exemplo n.º 2
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.º 3
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.º 4
0
 public GrainReferenceRuntime(
     IRuntimeClient runtimeClient,
     IGrainCancellationTokenRuntime cancellationTokenRuntime,
     IEnumerable <IOutgoingGrainCallFilter> outgoingCallFilters,
     GrainReferenceActivator referenceActivator,
     GrainInterfaceTypeResolver interfaceTypeResolver)
 {
     this.RuntimeClient            = runtimeClient;
     this.cancellationTokenRuntime = cancellationTokenRuntime;
     this.referenceActivator       = referenceActivator;
     this.interfaceTypeResolver    = interfaceTypeResolver;
     this.filters     = outgoingCallFilters.ToArray();
     this.sendRequest = (GrainReference reference, IResponseCompletionSource callback, IInvokable body, InvokeMethodOptions options) => RuntimeClient.SendRequest(reference, body, callback, options);
 }
Exemplo n.º 5
0
 public GrainReferenceRuntime(
     IRuntimeClient runtimeClient,
     IGrainCancellationTokenRuntime cancellationTokenRuntime,
     IEnumerable <IOutgoingGrainCallFilter> outgoingCallFilters,
     GrainReferenceActivator referenceActivator,
     GrainInterfaceTypeResolver interfaceTypeResolver,
     DeepCopier deepCopier)
 {
     this.RuntimeClient            = runtimeClient;
     this.cancellationTokenRuntime = cancellationTokenRuntime;
     this.referenceActivator       = referenceActivator;
     this.interfaceTypeResolver    = interfaceTypeResolver;
     this.filters     = outgoingCallFilters.ToArray();
     this.sendRequest = this.SendRequest;
     this.deepCopier  = deepCopier;
 }
Exemplo n.º 6
0
        public InsideRuntimeClient(
            ILocalSiloDetails siloDetails,
            TypeMetadataCache typeMetadataCache,
            OrleansTaskScheduler scheduler,
            IServiceProvider serviceProvider,
            MessageFactory messageFactory,
            ITransactionAgent transactionAgent,
            ILoggerFactory loggerFactory,
            IOptions <SiloMessagingOptions> messagingOptions,
            ApplicationRequestsStatisticsGroup appRequestStatistics,
            MessagingTrace messagingTrace,
            GrainReferenceActivator referenceActivator,
            GrainInterfaceTypeResolver interfaceIdResolver,
            GrainInterfaceTypeToGrainTypeResolver interfaceToTypeResolver,
            ImrGrainMethodInvokerProvider invokers)
        {
            this.ServiceProvider       = serviceProvider;
            this.MySilo                = siloDetails.SiloAddress;
            this.disposables           = new List <IDisposable>();
            this.callbacks             = new ConcurrentDictionary <CorrelationId, CallbackData>();
            this.messageFactory        = messageFactory;
            this.transactionAgent      = transactionAgent;
            this.Scheduler             = scheduler;
            this.ConcreteGrainFactory  = new GrainFactory(this, typeMetadataCache, referenceActivator, interfaceIdResolver, interfaceToTypeResolver);
            this.logger                = loggerFactory.CreateLogger <InsideRuntimeClient>();
            this.invokeExceptionLogger = loggerFactory.CreateLogger($"{typeof(Grain).FullName}.InvokeException");
            this.loggerFactory         = loggerFactory;
            this.messagingOptions      = messagingOptions.Value;
            this.appRequestStatistics  = appRequestStatistics;
            this.messagingTrace        = messagingTrace;
            this.invokers              = invokers;

            this.sharedCallbackData = new SharedCallbackData(
                msg => this.UnregisterCallback(msg.Id),
                this.loggerFactory.CreateLogger <CallbackData>(),
                this.messagingOptions,
                this.appRequestStatistics,
                this.messagingOptions.ResponseTimeout);

            this.systemSharedCallbackData = new SharedCallbackData(
                msg => this.UnregisterCallback(msg.Id),
                this.loggerFactory.CreateLogger <CallbackData>(),
                this.messagingOptions,
                this.appRequestStatistics,
                this.messagingOptions.SystemResponseTimeout);
        }
Exemplo n.º 7
0
 public GrainReferenceRuntime(
     IRuntimeClient runtimeClient,
     IGrainCancellationTokenRuntime cancellationTokenRuntime,
     SerializationManager serializationManager,
     IEnumerable <IOutgoingGrainCallFilter> outgoingCallFilters,
     GrainReferenceActivator referenceActivator,
     GrainInterfaceTypeResolver interfaceTypeResolver)
 {
     this.grainReferenceMethodCache = new InterfaceToImplementationMappingCache();
     this.sendRequestDelegate       = SendRequest;
     this.RuntimeClient             = runtimeClient;
     this.cancellationTokenRuntime  = cancellationTokenRuntime;
     this.serializationManager      = serializationManager;
     this.referenceActivator        = referenceActivator;
     this.interfaceTypeResolver     = interfaceTypeResolver;
     this.filters = outgoingCallFilters.ToArray();
 }
Exemplo n.º 8
0
 public GrainReferenceJsonConverter(GrainReferenceActivator referenceActivator)
 {
     this.referenceActivator = referenceActivator;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GrainReferenceKeyStringConverter"/> class.
 /// </summary>
 /// <param name="activator">The grain reference activator.</param>
 public GrainReferenceKeyStringConverter(GrainReferenceActivator activator)
 {
     _activator = activator;
 }
 public BinaryFormatterGrainReferenceSurrogate(GrainReferenceActivator activator)
 {
     _activator = activator;
 }
 public BinaryFormatterGrainReferenceSurrogateSelector(GrainReferenceActivator activator)
 {
     _surrogate = new BinaryFormatterGrainReferenceSurrogate(activator);
 }
 public GrainReferenceSerializer(GrainReferenceActivator activator)
 {
     _activator = activator;
 }