public InstanceMappingFileMonitor(TimeSpan checkInterval, IAsyncTimer timer, IInstanceMappingLoader loader, EndpointInstances endpointInstances)
 {
     this.checkInterval     = checkInterval;
     this.timer             = timer;
     this.loader            = loader;
     this.endpointInstances = endpointInstances;
 }
예제 #2
0
        public MembershipTableManager(
            ILocalSiloDetails localSiloDetails,
            IOptions <ClusterMembershipOptions> clusterMembershipOptions,
            IMembershipTable membershipTable,
            IFatalErrorHandler fatalErrorHandler,
            IMembershipGossiper gossiper,
            ILogger <MembershipTableManager> log,
            IAsyncTimerFactory timerFactory,
            ISiloLifecycle siloLifecycle)
        {
            this.localSiloDetails        = localSiloDetails;
            this.membershipTableProvider = membershipTable;
            this.fatalErrorHandler       = fatalErrorHandler;
            this.gossiper = gossiper;
            this.clusterMembershipOptions = clusterMembershipOptions.Value;
            this.myAddress     = this.localSiloDetails.SiloAddress;
            this.log           = log;
            this.siloLifecycle = siloLifecycle;
            this.snapshot      = new MembershipTableSnapshot(
                this.CreateLocalSiloEntry(this.CurrentStatus),
                MembershipVersion.MinValue,
                ImmutableDictionary <SiloAddress, MembershipEntry> .Empty);
            this.updates = new AsyncEnumerable <MembershipTableSnapshot>(
                (previous, proposed) => proposed.Version > previous.Version,
                this.snapshot)
            {
                OnPublished = update => Interlocked.Exchange(ref this.snapshot, update)
            };

            this.membershipUpdateTimer = timerFactory.Create(
                this.clusterMembershipOptions.TableRefreshTimeout,
                nameof(PeriodicallyRefreshMembershipTable));
        }
 public InstanceMappingFileMonitor(string filePath, TimeSpan checkInterval, IAsyncTimer timer, IInstanceMappingFileAccess fileAccess, EndpointInstances endpointInstances)
 {
     this.filePath = filePath;
     this.checkInterval = checkInterval;
     this.timer = timer;
     this.fileAccess = fileAccess;
     this.endpointInstances = endpointInstances;
 }
 public InstanceMappingFileMonitor(string filePath, TimeSpan checkInterval, IAsyncTimer timer, IInstanceMappingFileAccess fileAccess, EndpointInstances endpointInstances)
 {
     this.filePath          = filePath;
     this.checkInterval     = checkInterval;
     this.timer             = timer;
     this.fileAccess        = fileAccess;
     this.endpointInstances = endpointInstances;
 }
예제 #5
0
 public IncomingRequestMonitor(
     IAsyncTimerFactory asyncTimerFactory,
     IMessageCenter messageCenter,
     MessageFactory messageFactory,
     IOptionsMonitor <SiloMessagingOptions> siloMessagingOptions)
 {
     _scanPeriodTimer  = asyncTimerFactory.Create(TimeSpan.FromSeconds(1), nameof(IncomingRequestMonitor));
     _messageCenter    = messageCenter;
     _messageFactory   = messageFactory;
     _messagingOptions = siloMessagingOptions;
 }
예제 #6
0
 internal LocalReminderData(ReminderEntry entry, LocalReminderService reminderService)
 {
     Identity             = new ReminderIdentity(entry.GrainRef, entry.ReminderName);
     firstTickTime        = entry.StartAt;
     period               = entry.Period;
     remindable           = entry.GrainRef.Cast <IRemindable>();
     ETag                 = entry.ETag;
     LocalSequenceNumber  = -1;
     this.reminderService = reminderService;
     this.timer           = reminderService.asyncTimerFactory.Create(period, "");
 }
 public MembershipTableCleanupAgent(
     IOptions <ClusterMembershipOptions> clusterMembershipOptions,
     IMembershipTable membershipTableProvider,
     ILogger <MembershipTableCleanupAgent> log,
     IAsyncTimerFactory timerFactory)
 {
     this.clusterMembershipOptions = clusterMembershipOptions.Value;
     this.membershipTableProvider  = membershipTableProvider;
     this.log = log;
     if (this.clusterMembershipOptions.DefunctSiloCleanupPeriod.HasValue)
     {
         this.cleanupDefunctSilosTimer = timerFactory.Create(
             this.clusterMembershipOptions.DefunctSiloCleanupPeriod.Value,
             nameof(CleanupDefunctSilos));
     }
 }
예제 #8
0
 public ClusterHealthMonitor(
     MembershipTableManager tableManager,
     ILogger <ClusterHealthMonitor> log,
     IOptions <ClusterMembershipOptions> clusterMembershipOptions,
     IFatalErrorHandler fatalErrorHandler,
     IServiceProvider serviceProvider,
     IAsyncTimerFactory timerFactory)
 {
     this.tableManager              = tableManager;
     this.log                       = log;
     this.fatalErrorHandler         = fatalErrorHandler;
     this.clusterMembershipOptions  = clusterMembershipOptions.Value;
     this.monitorClusterHealthTimer = timerFactory.Create(
         this.clusterMembershipOptions.ProbeTimeout,
         nameof(MonitorClusterHealth));
     this.createMonitor = silo => ActivatorUtilities.CreateInstance <SiloHealthMonitor>(serviceProvider, silo);
 }
예제 #9
0
 public ClientObserverRegistrar(
     ILocalSiloDetails siloDetails,
     ILocalGrainDirectory grainDirectory,
     OrleansTaskScheduler scheduler,
     IOptions <SiloMessagingOptions> messagingOptions,
     ILoggerFactory loggerFactory,
     IClusterMembershipService clusterMembershipService,
     IAsyncTimerFactory timerFactory)
     : base(Constants.ClientObserverRegistrarId, siloDetails.SiloAddress, loggerFactory)
 {
     this.grainDirectory           = grainDirectory;
     this.myAddress                = siloDetails.SiloAddress;
     this.scheduler                = scheduler;
     this.clusterMembershipService = clusterMembershipService;
     this.messagingOptions         = messagingOptions.Value;
     this.logger       = loggerFactory.CreateLogger <ClientObserverRegistrar>();
     this.refreshTimer = timerFactory.Create(this.messagingOptions.ClientRegistrationRefresh, "ClientObserverRegistrar.ClientRefreshTimer");
 }
예제 #10
0
 public MembershipAgent(
     MembershipTableManager tableManager,
     ClusterHealthMonitor clusterHealthMonitor,
     ILocalSiloDetails localSilo,
     IFatalErrorHandler fatalErrorHandler,
     IOptions <ClusterMembershipOptions> options,
     ILogger <MembershipAgent> log,
     IAsyncTimerFactory timerFactory)
 {
     this.tableManager             = tableManager;
     this.clusterHealthMonitor     = clusterHealthMonitor;
     this.localSilo                = localSilo;
     this.fatalErrorHandler        = fatalErrorHandler;
     this.clusterMembershipOptions = options.Value;
     this.log           = log;
     this.iAmAliveTimer = timerFactory.Create(
         this.clusterMembershipOptions.IAmAliveTablePublishTimeout,
         nameof(UpdateIAmAlive));
 }
예제 #11
0
 internal LocalReminderService(
     Silo silo,
     IReminderTable reminderTable,
     TimeSpan initTimeout,
     ILoggerFactory loggerFactory,
     IAsyncTimerFactory asyncTimerFactory)
     : base(SystemTargetGrainId.CreateGrainServiceGrainId(GrainInterfaceUtils.GetGrainClassTypeCode(typeof(IReminderService)), null, silo.SiloAddress), silo, loggerFactory)
 {
     localReminders         = new Dictionary <ReminderIdentity, LocalReminderData>();
     this.reminderTable     = reminderTable;
     this.initTimeout       = initTimeout;
     this.asyncTimerFactory = asyncTimerFactory;
     localTableSequence     = 0;
     tardinessStat          = AverageTimeSpanStatistic.FindOrCreate(StatisticNames.REMINDERS_AVERAGE_TARDINESS_SECONDS);
     IntValueStatistic.FindOrCreate(StatisticNames.REMINDERS_NUMBER_ACTIVE_REMINDERS, () => localReminders.Count);
     ticksDeliveredStat    = CounterStatistic.FindOrCreate(StatisticNames.REMINDERS_COUNTERS_TICKS_DELIVERED);
     startedTask           = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously);
     this.logger           = loggerFactory.CreateLogger <LocalReminderService>();
     this.listRefreshTimer = asyncTimerFactory.Create(Constants.RefreshReminderList, "ReminderService.ReminderListRefresher");
 }
예제 #12
0
 public SiloHealthMonitor(
     SiloAddress siloAddress,
     Func <SiloHealthMonitor, ProbeResult, Task> onProbeResult,
     IOptions <ClusterMembershipOptions> clusterMembershipOptions,
     ILoggerFactory loggerFactory,
     IRemoteSiloProber remoteSiloProber,
     IAsyncTimerFactory asyncTimerFactory,
     ILocalSiloHealthMonitor localSiloHealthMonitor)
 {
     SiloAddress = siloAddress;
     _clusterMembershipOptions = clusterMembershipOptions.Value;
     _prober = remoteSiloProber;
     _localSiloHealthMonitor = localSiloHealthMonitor;
     _log       = loggerFactory.CreateLogger <SiloHealthMonitor>();
     _pingTimer = asyncTimerFactory.Create(
         _clusterMembershipOptions.ProbeTimeout,
         nameof(SiloHealthMonitor));
     _onProbeResult = onProbeResult;
     _elapsedSinceLastSuccessfulResponse = ValueStopwatch.StartNew();
 }
예제 #13
0
        public MembershipTableManager(
            ILocalSiloDetails localSiloDetails,
            IOptions <ClusterMembershipOptions> clusterMembershipOptions,
            IMembershipTable membershipTable,
            IFatalErrorHandler fatalErrorHandler,
            IMembershipGossiper gossiper,
            ILogger <MembershipTableManager> log,
            IAsyncTimerFactory timerFactory)
        {
            this.localSiloDetails        = localSiloDetails;
            this.membershipTableProvider = membershipTable;
            this.fatalErrorHandler       = fatalErrorHandler;
            this.gossiper = gossiper;
            this.clusterMembershipOptions = clusterMembershipOptions.Value;
            this.myAddress = this.localSiloDetails.SiloAddress;
            this.log       = log;

            var backOffMax = StandardExtensions.Max(EXP_BACKOFF_STEP.Multiply(this.clusterMembershipOptions.ExpectedClusterSize), SiloMessageSender.CONNECTION_RETRY_DELAY.Multiply(2));

            this.EXP_BACKOFF_CONTENTION_MAX = backOffMax;
            this.EXP_BACKOFF_ERROR_MAX      = backOffMax;

            this.snapshot = new MembershipTableSnapshot(
                this.CreateLocalSiloEntry(this.CurrentStatus),
                MembershipVersion.MinValue,
                ImmutableDictionary <SiloAddress, MembershipEntry> .Empty);
            this.updates = new AsyncEnumerable <MembershipTableSnapshot>(
                (previous, proposed) => proposed.Version > previous.Version,
                this.snapshot)
            {
                OnPublished = update => Interlocked.Exchange(ref this.snapshot, update)
            };

            this.membershipUpdateTimer = timerFactory.Create(
                this.clusterMembershipOptions.TableRefreshTimeout,
                nameof(PeriodicallyRefreshMembershipTable));
        }
예제 #14
0
 public LocalSiloHealthMonitor(
     IEnumerable <IHealthCheckParticipant> healthCheckParticipants,
     MembershipTableManager membershipTableManager,
     ConnectionManager connectionManager,
     ClusterHealthMonitor clusterHealthMonitor,
     ILocalSiloDetails localSiloDetails,
     ILogger <LocalSiloHealthMonitor> log,
     IOptions <ClusterMembershipOptions> clusterMembershipOptions,
     IAsyncTimerFactory timerFactory,
     ILoggerFactory loggerFactory,
     ProbeRequestMonitor probeRequestMonitor)
 {
     _healthCheckParticipants = healthCheckParticipants.ToList();
     _membershipTableManager  = membershipTableManager;
     _clusterHealthMonitor    = clusterHealthMonitor;
     _localSiloDetails        = localSiloDetails;
     _log = log;
     _probeRequestMonitor      = probeRequestMonitor;
     _clusterMembershipOptions = clusterMembershipOptions.Value;
     _degradationCheckTimer    = timerFactory.Create(
         _clusterMembershipOptions.LocalHealthDegradationMonitoringPeriod,
         nameof(LocalSiloHealthMonitor));
     _threadPoolMonitor = new ThreadPoolMonitor(loggerFactory.CreateLogger <ThreadPoolMonitor>());
 }
 public Cleaner(Func <CancellationToken, Task> cleanup, Action <string, Exception> criticalError, TimeSpan frequencyToRunCleanup, IAsyncTimer timer)
 {
     this.cleanup = cleanup;
     this.frequencyToRunCleanup = frequencyToRunCleanup;
     this.timer         = timer;
     this.criticalError = criticalError;
 }
 public OutboxCleaner(Func <DateTime, CancellationToken, Task> cleanup, Action <string, Exception, CancellationToken> criticalError, TimeSpan timeToKeepDeduplicationData, TimeSpan frequencyToRunCleanup, IAsyncTimer timer)
 {
     this.cleanup = cleanup;
     this.timeToKeepDeduplicationData = timeToKeepDeduplicationData;
     this.frequencyToRunCleanup       = frequencyToRunCleanup;
     this.timer         = timer;
     this.criticalError = criticalError;
 }
 public TestableCleaner(Func <DateTime, CancellationToken, Task> cleanup, Action <string, Exception> criticalError, TimeSpan timeToKeepDeduplicationData, TimeSpan frequencyToRunCleanup, IAsyncTimer timer)
     : base(cleanup, criticalError, timeToKeepDeduplicationData, frequencyToRunCleanup, timer)
 {
 }
예제 #18
0
        public BlobStorageDataBus(CloudBlobContainer container, DataBusSettings settings, IAsyncTimer timer)
        {
            this.container = container;
            this.settings  = settings;
            this.timer     = timer;

            retryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(settings.BackOffInterval), settings.MaxRetries);
        }
 public TestableCleaner(Func <CancellationToken, Task> cleanup, Action <string, Exception> criticalError, TimeSpan frequencyToRunCleanup, IAsyncTimer timer)
     : base(cleanup, criticalError, frequencyToRunCleanup, timer)
 {
 }