Esempio n. 1
0
        public PingToManagerTimer(NodeConfiguration nodeConfiguration,
                                  IHttpSender httpSender) : base(nodeConfiguration.PingToManagerSeconds * 1000)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            _exceptionLoggerHandler  = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());
            _nodeConfiguration       = nodeConfiguration;
            _httpSender = httpSender;
            _whoAmI     = nodeConfiguration.CreateWhoIAm(Environment.MachineName);

            Elapsed += OnTimedEvent;
        }
        public TrySendStatusToManagerTimer(NodeConfiguration nodeConfiguration,
                                           Uri callbackTemplateUri,
                                           JobDetailSender jobDetailSender,
                                           IHttpSender httpSender, double interval = 500) : base(interval)
        {
            _cancellationTokenSource = new CancellationTokenSource();
            _whoAmI                 = nodeConfiguration.CreateWhoIAm(Environment.MachineName);
            _enableGc               = nodeConfiguration.EnableGarbageCollection;
            _jobDetailSender        = jobDetailSender;
            _httpSender             = httpSender;
            CallbackTemplateUri     = callbackTemplateUri;
            _exceptionLoggerHandler = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());

            Elapsed  += OnTimedEvent;
            AutoReset = true;
        }
        public TrySendNodeStartUpNotificationToManagerTimer(NodeConfiguration nodeConfiguration,
                                                            IHttpSender httpSender,
                                                            double interval = 5000,
                                                            bool autoReset  = true) : base(interval)
        {
            var callbackToManagerTemplateUri = nodeConfiguration.GetManagerNodeHasBeenInitializedUri();

            _cancellationTokenSource      = new CancellationTokenSource();
            _nodeConfiguration            = nodeConfiguration;
            _callbackToManagerTemplateUri = callbackToManagerTemplateUri;
            _httpSender             = httpSender;
            _whoAmI                 = _nodeConfiguration.CreateWhoIAm(Environment.MachineName);
            _exceptionLoggerHandler = new TimerExceptionLoggerStrategyHandler(TimerExceptionLoggerStrategyHandler.DefaultLogInterval, GetType());

            Elapsed  += OnTimedEvent;
            AutoReset = autoReset;
        }