Beispiel #1
0
        public Dictionary <string, string> ToDictionary(Dictionary <string, string> baseDictionary)
        {
            var newConfig = baseDictionary == null ? new Dictionary <string, string>() : new Dictionary <string, string>(baseDictionary);

            newConfig[STATUS]           = Status == CallHomeStatus.Enabled ? "true" : "false";
            newConfig[INTERVAL_IN_DAYS] = IntervalInDays.ToString();
            var day = (int)DayOfWeek;

            newConfig[DAY_OF_WEEK]         = day.ToString();
            newConfig[TIME_OF_DAY]         = TimeOfDay.ToString();
            newConfig[RETRY_INTERVAL]      = RetryInterval.ToString();
            newConfig[UPLOAD_TOKEN_SECRET] = UploadTokenSecretUuid;
            newConfig[NEW_UPLOAD_REQUEST]  = NewUploadRequest;
            return(newConfig);
        }
Beispiel #2
0
        private void ActionFailed(NativeActivityFaultContext faultcontext, Exception propagatedexception, ActivityInstance propagatedfrom)
        {
            Int32 currentAttemptCount = _attemptCount.Get(faultcontext);

            currentAttemptCount++;

            _attemptCount.Set(faultcontext, currentAttemptCount);

            Int32 maxAttempts = MaxAttempts.Get(faultcontext);

            if (currentAttemptCount >= maxAttempts)
            {
                // There are no further attempts to make
                return;
            }

            if (ShouldRetryAction(ExceptionType, propagatedexception) == false)
            {
                return;
            }

            faultcontext.CancelChild(propagatedfrom);
            faultcontext.HandleFault();

            TimeSpan retryInterval = RetryInterval.Get(faultcontext);

            if (retryInterval == TimeSpan.Zero)
            {
                ExecuteAttempt(faultcontext);
            }
            else
            {
                // We are going to wait before trying again
                _delayDuration.Set(faultcontext, retryInterval);

                faultcontext.ScheduleActivity(_internalDelay, DelayCompleted);
            }
        }
Beispiel #3
0
        void ReleaseDesignerOutlets()
        {
            if (AdminEmail != null)
            {
                AdminEmail.Dispose();
                AdminEmail = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (ExpiresAfter != null)
            {
                ExpiresAfter.Dispose();
                ExpiresAfter = null;
            }

            if (MinimumTTL != null)
            {
                MinimumTTL.Dispose();
                MinimumTTL = null;
            }

            if (PrimaryServerName != null)
            {
                PrimaryServerName.Dispose();
                PrimaryServerName = null;
            }

            if (RefreshInterval != null)
            {
                RefreshInterval.Dispose();
                RefreshInterval = null;
            }

            if (RetryInterval != null)
            {
                RetryInterval.Dispose();
                RetryInterval = null;
            }

            if (SerialNumber != null)
            {
                SerialNumber.Dispose();
                SerialNumber = null;
            }

            if (UpdateButton != null)
            {
                UpdateButton.Dispose();
                UpdateButton = null;
            }

            if (ZoneType != null)
            {
                ZoneType.Dispose();
                ZoneType = null;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 스케쥴러에 의해 주기적으로 호출되는 작업의 본체
        /// </summary>
        /// <param name="context"></param>
        public virtual void Execute(JobExecutionContext context)
        {
            var jobName = context.JobDetail.FullName;

            if (IsDebugEnabled)
            {
                log.Debug(@"Job[{0}]을 실행합니다...", jobName);
            }

            if (Enabled == false)
            {
                if (IsDebugEnabled)
                {
                    log.Debug(@"작업[{0}]이 사용가능 상태가 아니기 때문에, 작업을 수행하지 않습니다. Enabled=[{1}]", jobName, Enabled);
                }
                return;
            }

            var dataMap    = context.JobDetail.JobDataMap;
            var retryCount = dataMap.GetJobData(JobTool.RetryCountKey).AsInt(0);

            try {
                DoExecute(context, CancellationTokenSource.Token);

                // 작업이 성공했으면, 재실행횟수를 0으로 리셋합니다.
                dataMap.SetJobData(JobTool.RetryCountKey, 0);

                if (IsDebugEnabled)
                {
                    log.Debug(@"Job [{0}]을 완료했습니다!!!", jobName);
                }
            }
            catch (Exception ex) {
                retryCount++;

                if (log.IsWarnEnabled)
                {
                    log.Warn(@"작업[{0}] 실행 중 예외가 발생했습니다. 재실행 횟수=[{1}]", jobName, retryCount);
                    log.Warn(ex);
                }

                if (CancellationTokenSource.Token.IsCancellationRequested)
                {
                    return;
                }

                //! 최대 재실행 횟수가 존재한다면, 재실행을 즉시 실행하도록 하고, JobExecutionException을 발생시키면, Quartz가 Job을 즉시 재실행시킵니다.
                //
                var maxRetryCount = Math.Max(0, MaxRetryCount.AsInt(0));
                var canRetry      = (maxRetryCount > 0 && retryCount < maxRetryCount);

                if (canRetry)
                {
                    Thread.Sleep(Math.Max(10, RetryInterval.AsInt(10)));
                    dataMap.SetJobData(JobTool.RetryCountKey, retryCount);
                    throw new JobExecutionException(ex)
                          {
                              RefireImmediately = true
                          };
                }
            }
        }