コード例 #1
0
 /// <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;
 }
コード例 #2
0
ファイル: GrainRuntime.cs プロジェクト: stanroze/orleans
 public GrainRuntime(string siloId, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager)
 {
     SiloIdentity = siloId;
     GrainFactory = grainFactory;
     TimerRegistry = timerRegistry;
     ReminderRegistry = reminderRegistry;
     StreamProviderManager = streamProviderManager;
 }
コード例 #3
0
 public TestGrainRuntime(IGrainFactory grainFactory, ITimerRegistry timerRegistry, IStreamProviderManager streamProviderManager, IReminderRegistry reminderRegistry, IServiceProvider serviceProvider)
 {
     GrainFactory          = grainFactory;
     TimerRegistry         = timerRegistry;
     StreamProviderManager = streamProviderManager;
     ReminderRegistry      = reminderRegistry;
     ServiceProvider       = serviceProvider;
 }
コード例 #4
0
 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));
 }
コード例 #5
0
ファイル: GrainRuntime.cs プロジェクト: supwar/orleans
 public GrainRuntime(string siloId, IGrainFactory grainFactory, ITimerRegistry timerRegistry, IReminderRegistry reminderRegistry, IStreamProviderManager streamProviderManager)
 {
     SiloIdentity          = siloId;
     GrainFactory          = grainFactory;
     TimerRegistry         = timerRegistry;
     ReminderRegistry      = reminderRegistry;
     StreamProviderManager = streamProviderManager;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 /// <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>();
 }
コード例 #8
0
ファイル: GrainRuntime.cs プロジェクト: Rejendo/orleans
 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;
 }
コード例 #9
0
 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;
 }
コード例 #10
0
ファイル: GrainRuntime.cs プロジェクト: veikkoeeva/orleans
 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;
 }
コード例 #11
0
ファイル: GrainRuntime.cs プロジェクト: jdom/orleans
 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;
 }
コード例 #12
0
 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;
 }
コード例 #13
0
ファイル: GrainRuntime.cs プロジェクト: zloop1982/orleans
 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;
 }
コード例 #14
0
        /// <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));
        }
コード例 #15
0
 internal TimerService(Grain grain)
 {
     this.grain    = grain;
     this.registry = grain.Runtime().TimerRegistry;
 }
コード例 #16
0
ファイル: GenericGrains.cs プロジェクト: pipermatt/orleans
 public PingSelfGrain(ILogger <PingSelfGrain <T> > logger, IGrainContext context, ITimerRegistry timerRegistry)
 {
     this.logger       = logger;
     this.GrainContext = context;
     _timerRegistry    = timerRegistry;
 }
コード例 #17
0
 public DistributedCacheGrain(ITimerRegistry timerRegistry)
 {
     this.timerRegistry = timerRegistry;
 }
コード例 #18
0
 public TestGrainRuntime(IGrainFactory grainFactory, ITimerRegistry timerRegistry, IStreamProviderManager streamProviderManager)
 {
     GrainFactory          = grainFactory;
     TimerRegistry         = timerRegistry;
     StreamProviderManager = streamProviderManager;
 }