Ejemplo n.º 1
0
        public HostingShutdown(
            ApplicationShutdown appShutdown,
            IServiceBeacon serviceBeacon,
            IServiceLocator serviceLocator,
            IVostokApplicationIdentity identity,
            IMetricContext instanceMetrics,
            ILog log,
            CancellationToken token,
            TimeSpan totalTimeout,
            TimeSpan beaconTimeout,
            bool beaconWaitEnabled,
            bool sendAnnotation)
        {
            this.appShutdown     = appShutdown;
            this.serviceBeacon   = serviceBeacon;
            this.serviceLocator  = serviceLocator;
            this.identity        = identity;
            this.instanceMetrics = instanceMetrics;
            this.log             = log.ForContext <HostingShutdown>();

            this.totalTimeout      = totalTimeout;
            this.beaconTimeout     = beaconTimeout;
            this.beaconWaitEnabled = beaconWaitEnabled;
            this.sendAnnotation    = sendAnnotation;

            hostShutdownBudget = TimeBudget.CreateNew(totalTimeout);
            tokenRegistration  = token.Register(OnHostShutdownTriggered);
        }