public void Configure(GrainType grainType, GrainProperties properties, GrainTypeSharedContext shared) { if (_grainClassMap.TryGetGrainClass(grainType, out var grainClass) && grainClass.IsAssignableFrom(typeof(ExplicitlyRegisteredSimpleDIGrain))) { shared.SetComponent <IGrainActivator>(this); } }
public ActivationDataActivator( IGrainActivator grainActivator, IServiceProvider serviceProvider, GrainTypeSharedContext sharedComponents, ILogger <WorkItemGroup> workItemGroupLogger, ILogger <ActivationTaskScheduler> activationTaskSchedulerLogger, SchedulerStatisticsGroup schedulerStatisticsGroup, IOptions <SchedulingOptions> schedulingOptions, IOptions <StatisticsOptions> statisticsOptions) { _workItemGroupLogger = workItemGroupLogger; _activationTaskSchedulerLogger = activationTaskSchedulerLogger; _schedulerStatisticsGroup = schedulerStatisticsGroup; _schedulingOptions = schedulingOptions; _statisticsOptions = statisticsOptions; _grainActivator = grainActivator; _serviceProvider = serviceProvider; _sharedComponents = sharedComponents; _createWorkItemGroup = context => new WorkItemGroup( context, _workItemGroupLogger, _activationTaskSchedulerLogger, _schedulerStatisticsGroup, _statisticsOptions, _schedulingOptions); }
public void Configure(GrainType grainType, GrainProperties properties, GrainTypeSharedContext shared) { if (properties.Properties.TryGetValue(WellKnownGrainTypeProperties.Reentrant, out var value) && bool.Parse(value)) { var component = shared.GetComponent <GrainCanInterleave>(); if (component is null) { component = new GrainCanInterleave(); shared.SetComponent <GrainCanInterleave>(component); } component.MayInterleavePredicates.Add(_ => true); } }
public void Configure(GrainType grainType, GrainProperties properties, GrainTypeSharedContext shared) { if (shared.GetComponent <IGrainActivator>() is object) { return; } if (!_grainClassMap.TryGetGrainClass(grainType, out var grainClass)) { return; } var argumentFactory = _constructorArgumentFactory.CreateFactory(grainClass); var createGrainInstance = ActivatorUtilities.CreateFactory(grainClass, argumentFactory.ArgumentTypes); var instanceActivator = new DefaultGrainActivator(createGrainInstance, argumentFactory); shared.SetComponent <IGrainActivator>(instanceActivator); }
public StatelessWorkerActivator(GrainTypeSharedContext sharedContext, IGrainContextActivator innerActivator) { _innerActivator = innerActivator; _sharedContext = sharedContext; }