/// <summary> /// Constructor /// </summary> public LeaseBasedQueueBalancer(string name, LeaseBasedQueueBalancerOptions options, ILeaseProvider leaseProvider, ITimerRegistry timerRegistry, IServiceProvider services, ILoggerFactory loggerFactory) : base(services, loggerFactory.CreateLogger($"{typeof(LeaseBasedQueueBalancer).FullName}.{name}")) { this.options = options; this.leaseProvider = leaseProvider; this.timerRegistry = timerRegistry; }
public GrainRuntime(string siloId, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager) { SiloIdentity = siloId; GrainFactory = grainFactory; TimerRegistry = timerRegistry; ReminderRegistry = reminderRegistry; StreamProviderManager = streamProviderManager; }
public TestGrainRuntime(IGrainFactory grainFactory, ITimerRegistry timerRegistry, IStreamProviderManager streamProviderManager, IReminderRegistry reminderRegistry, IServiceProvider serviceProvider) { GrainFactory = grainFactory; TimerRegistry = timerRegistry; StreamProviderManager = streamProviderManager; ReminderRegistry = reminderRegistry; ServiceProvider = serviceProvider; }
public TestGrainRuntime(IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IServiceProvider serviceProvider, StorageManager storageManager) { GrainFactory = grainFactory ?? throw new ArgumentNullException(nameof(grainFactory)); TimerRegistry = timerRegistry ?? throw new ArgumentNullException(nameof(timerRegistry)); ReminderRegistry = reminderRegistry ?? throw new ArgumentNullException(nameof(reminderRegistry)); ServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _storageManager = storageManager ?? throw new ArgumentNullException(nameof(storageManager)); }
public GrainRuntime(string id, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager) { this.id = id; this.grainFactory = grainFactory; this.timerRegistry = timerRegistry; this.reminderRegistry = reminderRegistry; this.streamProviderManager = streamProviderManager; }
/// <summary> /// Constructor /// </summary> public LeaseBasedQueueBalancer(string name, LeaseBasedQueueBalancerOptions options, ILeaseProvider leaseProvider, ITimerRegistry timerRegistry, IServiceProvider services, ILoggerFactory loggerFactory) : base(services, loggerFactory.CreateLogger($"{nameof(LeaseBasedQueueBalancer)}-{name}")) { this.options = options; this.leaseProvider = leaseProvider; this.timerRegistry = timerRegistry; this.executor = new AsyncSerialExecutor(); this.myQueues = new List <AcquiredQueue>(); }
public GrainRuntime(Guid serviceId, string siloId, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager, IServiceProvider serviceProvider) { ServiceId = serviceId; SiloIdentity = siloId; GrainFactory = grainFactory; TimerRegistry = timerRegistry; ReminderRegistry = reminderRegistry; StreamProviderManager = streamProviderManager; ServiceProvider = serviceProvider; }
public GrainRuntime( ILocalSiloDetails localSiloDetails, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IServiceProvider serviceProvider, ILoggerFactory loggerFactory) { SiloAddress = localSiloDetails.SiloAddress; SiloIdentity = SiloAddress.ToLongString(); this.grainFactory = grainFactory; this.timerRegistry = timerRegistry; this.reminderRegistry = reminderRegistry; this.serviceProvider = serviceProvider; this.loggerFactory = loggerFactory; }
public GrainRuntime( GlobalConfiguration globalConfig, ILocalSiloDetails localSiloDetails, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager, IServiceProvider serviceProvider, IRuntimeClient runtimeClient) { this.runtimeClient = runtimeClient; ServiceId = globalConfig.ServiceId; SiloIdentity = localSiloDetails.SiloAddress.ToLongString(); GrainFactory = grainFactory; TimerRegistry = timerRegistry; ReminderRegistry = reminderRegistry; StreamProviderManager = streamProviderManager; ServiceProvider = serviceProvider; }
public GrainRuntime( IOptions <ClusterOptions> clusterOptions, ILocalSiloDetails localSiloDetails, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IServiceProvider serviceProvider, ISiloRuntimeClient runtimeClient, ILoggerFactory loggerFactory) { this.runtimeClient = runtimeClient; ServiceId = clusterOptions.Value.ServiceId; SiloAddress = localSiloDetails.SiloAddress; SiloIdentity = SiloAddress.ToLongString(); this.grainFactory = grainFactory; this.timerRegistry = timerRegistry; this.reminderRegistry = reminderRegistry; this.serviceProvider = serviceProvider; this.loggerFactory = loggerFactory; }
/// <inheritdoc/> public override Task Initialize(IStreamQueueMapper queueMapper) { if (queueMapper == null) { throw new ArgumentNullException("queueMapper"); } this.allQueues = new ReadOnlyCollection <QueueId>(queueMapper.GetAllQueues().ToList()); if (this.allQueues.Count == 0) { return(Task.CompletedTask); } this.leaseProvider = this.serviceProvider.GetRequiredService(options.LeaseProviderType) as ILeaseProvider; NotifyAfterStart().Ignore(); //make lease renew frequency to be every half of lease time, to avoid renew failing due to timing issues, race condition or clock difference. ITimerRegistry timerRegistry = this.serviceProvider.GetRequiredService <ITimerRegistry>(); this.renewLeaseTimer = timerRegistry.RegisterTimer(null, this.MaintainAndBalanceQueues, null, this.options.SiloMaturityPeriod, this.options.LeaseLength.Divide(2)); //try to acquire maximum leases every leaseLength this.tryAcquireMaximumLeaseTimer = timerRegistry.RegisterTimer(null, this.AcquireLeaseToMeetMaxResponsibility, null, this.options.SiloMaturityPeriod, this.options.SiloMaturityPeriod); //Selector default to round robin selector now, but we can make a further change to make selector configurable if needed. Selector algorithm could //be affecting queue balancing stablization time in cluster initializing and auto-scaling this.queueSelector = new RoundRobinSelector <QueueId>(this.allQueues); return(MaintainAndBalanceQueues(null)); }
internal TimerService(Grain grain) { this.grain = grain; this.registry = grain.Runtime().TimerRegistry; }
public PingSelfGrain(ILogger <PingSelfGrain <T> > logger, IGrainContext context, ITimerRegistry timerRegistry) { this.logger = logger; this.GrainContext = context; _timerRegistry = timerRegistry; }
public DistributedCacheGrain(ITimerRegistry timerRegistry) { this.timerRegistry = timerRegistry; }
public TestGrainRuntime(IGrainFactory grainFactory, ITimerRegistry timerRegistry, IStreamProviderManager streamProviderManager) { GrainFactory = grainFactory; TimerRegistry = timerRegistry; StreamProviderManager = streamProviderManager; }