当前位置: 首页>>代码示例>>C#>>正文


C# SchedulerInstruction类代码示例

本文整理汇总了C#中SchedulerInstruction的典型用法代码示例。如果您正苦于以下问题:C# SchedulerInstruction类的具体用法?C# SchedulerInstruction怎么用?C# SchedulerInstruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SchedulerInstruction类属于命名空间,在下文中一共展示了SchedulerInstruction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TriggerComplete

 public override void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
 {
     Log.TraceFormat("Trigger complete for job {0} with scheduler instruction {1}",
         context.JobDetail.JobType,
         triggerInstructionCode
     );
 }
开发者ID:mattgwagner,项目名称:Task-Processor,代码行数:7,代码来源:TriggerListener.cs

示例2: TriggerComplete

        /// <summary>
        /// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
        /// has fired, it's associated <see cref="IJobDetail" />
        /// has been executed, and it's <see cref="IOperableTrigger.Triggered" /> method has been
        /// called.
        /// </summary>
        /// <param name="trigger"></param>
        /// <param name="context"></param>
        /// <param name="triggerInstructionCode"></param>
        public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
        {
            Logger.InfoFormat("TriggerComplete: {0}, {1}", trigger.Key.Name, trigger.Key.Group);

            var auditLog = GetAuditLog(trigger, "TriggerComplete", context);
            _persistanceStore.InsertAuditLog(auditLog);
        }
开发者ID:R-Suite,项目名称:R.Scheduler,代码行数:16,代码来源:AuditTriggerListener.cs

示例3: TriggerComplete

 public void TriggerComplete(Trigger trigger, JobExecutionContext context, SchedulerInstruction triggerInstructionCode)
 {
     if (!trigger.Name.Equals("TimerTrigger"))
     {
         Account account = (Account)trigger.JobDataMap.Get("account");
         if (account != null)
         {
             SimpleTrigger triggerObject = new SimpleTrigger(account.Login + "Trigger", "account", DateTime.MinValue, null, 0, TimeSpan.Zero);
             triggerObject.JobName = account.Login + "Job";
             triggerObject.StartTimeUtc = DateTime.UtcNow.AddSeconds(new Random().Next(account.Settings.NextTimeLoginMin, account.Settings.NextTimeLoginMax));
             account.SchedulerTrigger = triggerObject;
             triggerObject.JobDataMap.Add("account", account);
             m_accountManager.SetNextLoginTimeForAccount(account);
         }
     }
 }
开发者ID:wrobeseb,项目名称:parRobot,代码行数:16,代码来源:AccountTriggerListener.cs

示例4: TriggerComplete

        public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
        {
            try
            {
                //var executationDuration = (DateTime.UtcNow - trigger.GetPreviousFireTimeUtc()).Value.TotalSeconds;
                var executionDuration = context.JobRunTime.TotalSeconds;
                TriggerStatistic triggerStat = new TriggerStatistic()
                {
                    Group = trigger.Key.Group,
                    JobKey = trigger.JobKey.Name,
                    TriggerKey = trigger.Key.Name,
                    ExecutionDurationInSeconds = executionDuration,
                    StartTime = trigger.GetPreviousFireTimeUtc().Value.DateTime.ToLocalTime(),
                    FinishTime = DateTime.Now
                };

                Sitecore.Diagnostics.Log.Info(String.Format("Job {0} with trigger {1} Completed @ {2} and it took {3} seconds ", triggerStat.JobKey, triggerStat.TriggerKey, DateTime.Now, triggerStat.ExecutionDurationInSeconds), this);

                string triggerStatProviderType = Settings.GetSetting("Sitecore.QuartzScheduler.TriggerStatisticsStoreProvider");

                if (!String.IsNullOrEmpty(triggerStatProviderType))
                {
                    var triggerStatsProvider = Activator.CreateInstance(Type.GetType(triggerStatProviderType)) as ITriggerStatisticsStore;
                    triggerStatsProvider.SaveTriggerStatistic(triggerStat);
                }
                else
                {
                    Sitecore.Diagnostics.Log.Warn("Sitecore.QuartzScheuler: Missing App Setting value for Sitecore.QuartzScheduler.TriggerStatisticsStoreProvider", this);
                }

            }
            catch(Exception ex)
            {
                Sitecore.Diagnostics.Log.Error("Exception in TriggerComplete: " + ex.Message + Environment.NewLine + ex.StackTrace, this);
            }
        }
开发者ID:badalk,项目名称:Scheduler,代码行数:36,代码来源:SchedulerTriggerListener.cs

示例5: NotifyTriggerListenersComplete

        /// <summary>
        /// Notifies the trigger listeners of completion.
        /// </summary>
        /// <param name="jec">The job executution context.</param>
        /// <param name="instCode">The instruction code to report to triggers.</param>
        public virtual void NotifyTriggerListenersComplete(IJobExecutionContext jec, SchedulerInstruction instCode)
        {
            // build a list of all trigger listeners that are to be notified...
            IEnumerable<ITriggerListener> listeners = BuildTriggerListenerList();

            // notify all trigger listeners in the list
            foreach (ITriggerListener tl in listeners)
            {
                if (!MatchTriggerListener(tl, jec.Trigger.Key))
                {
                    continue;
                }
                try
                {
                    tl.TriggerComplete(jec.Trigger, jec, instCode);
                }
                catch (Exception e)
                {
                    SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "TriggerListener '{0}' threw exception: {1}", tl.Name, e.Message), e);
                    throw se;
                }
            }
        }
开发者ID:natenho,项目名称:quartznet,代码行数:28,代码来源:QuartzScheduler.cs

示例6: TriggerComplete

 public void TriggerComplete(ITrigger trigger,
                             IJobExecutionContext context,
                             SchedulerInstruction triggerInstructionCode)
 {
 }
开发者ID:CharlieBP,项目名称:quartznet,代码行数:5,代码来源:SchedulerListenerTest.cs

示例7: TriggerComplete

 public Task TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
 {
     return Task.WhenAll(listeners.Select(l => l.TriggerComplete(trigger, context, triggerInstructionCode)));
 }
开发者ID:jvilalta,项目名称:quartznet,代码行数:4,代码来源:BroadcastTriggerListener.cs

示例8: TriggeredJobComplete

        protected virtual void TriggeredJobComplete(ConnectionAndTransactionHolder conn,
                                                    IOperableTrigger trigger,
                                                    IJobDetail jobDetail, SchedulerInstruction triggerInstCode)
        {
            try
            {
                if (triggerInstCode == SchedulerInstruction.DeleteTrigger)
                {
                    if (!trigger.GetNextFireTimeUtc().HasValue)
                    {
                        // double check for possible reschedule within job
                        // execution, which would cancel the need to delete...
                        TriggerStatus stat = Delegate.SelectTriggerStatus(conn, trigger.Key);
                        if (stat != null && !stat.NextFireTimeUtc.HasValue)
                        {
                            RemoveTrigger(conn, trigger.Key);
                        }
                    }
                    else
                    {
                        RemoveTrigger(conn, trigger.Key);
                        SignalSchedulingChangeOnTxCompletion(null);
                    }
                }
                else if (triggerInstCode == SchedulerInstruction.SetTriggerComplete)
                {
                    Delegate.UpdateTriggerState(conn, trigger.Key, StateComplete);
                    SignalSchedulingChangeOnTxCompletion(null);
                }
                else if (triggerInstCode == SchedulerInstruction.SetTriggerError)
                {
                    Log.Info("Trigger " + trigger.Key + " set to ERROR state.");
                    Delegate.UpdateTriggerState(conn, trigger.Key, StateError);
                    SignalSchedulingChangeOnTxCompletion(null);
                }
                else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersComplete)
                {
                    Delegate.UpdateTriggerStatesForJob(conn, trigger.JobKey, StateComplete);
                    SignalSchedulingChangeOnTxCompletion(null);
                }
                else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersError)
                {
                    Log.Info("All triggers of Job " + trigger.JobKey + " set to ERROR state.");
                    Delegate.UpdateTriggerStatesForJob(conn, trigger.JobKey, StateError);
                    SignalSchedulingChangeOnTxCompletion(null);
                }

                if (jobDetail.ConcurrentExecutionDisallowed)
                {
                    Delegate.UpdateTriggerStatesForJobFromOtherState(conn, jobDetail.Key, StateWaiting, StateBlocked);
                    Delegate.UpdateTriggerStatesForJobFromOtherState(conn, jobDetail.Key, StatePaused, StatePausedBlocked);
                    SignalSchedulingChangeOnTxCompletion(null);
                }
                if (jobDetail.PersistJobDataAfterExecution)
                {
                    try
                    {
                        if (jobDetail.JobDataMap.Dirty)
                        {
                            Delegate.UpdateJobData(conn, jobDetail);
                        }
                    }
                    catch (IOException e)
                    {
                        throw new JobPersistenceException("Couldn't serialize job data: " + e.Message, e);
                    }
                    catch (Exception e)
                    {
                        throw new JobPersistenceException("Couldn't update job data: " + e.Message, e);
                    }
                }
            }
            catch (Exception e)
            {
                throw new JobPersistenceException("Couldn't update trigger state(s): " + e.Message, e);
            }

            try
            {
                Delegate.DeleteFiredTrigger(conn, trigger.FireInstanceId);
            }
            catch (Exception e)
            {
                throw new JobPersistenceException("Couldn't delete fired trigger: " + e.Message, e);
            }
        }
开发者ID:valeriob,项目名称:quartznet,代码行数:86,代码来源:JobStoreSupport.cs

示例9: TriggerComplete

 public Task TriggerComplete(ITrigger trigger,
                             IJobExecutionContext context,
                             SchedulerInstruction triggerInstructionCode)
 {
     return TaskUtil.CompletedTask;
 }
开发者ID:jvilalta,项目名称:quartznet,代码行数:6,代码来源:SchedulerListenerTest.cs

示例10: VetoedJobRetryLoop

		/// <summary>
		/// Vetoeds the job retry loop.
		/// </summary>
		/// <param name="trigger">The trigger.</param>
		/// <param name="jobDetail">The job detail.</param>
		/// <param name="instCode">The inst code.</param>
		/// <returns></returns>
        public bool VetoedJobRetryLoop(Trigger trigger, JobDetail jobDetail, SchedulerInstruction instCode)
        {
            while (!shutdownRequested)
            {
                try
                {
                    Thread.Sleep(5 * 1000); // retry every 5 seconds (the db
                    // connection must be failed)
                    qs.NotifyJobStoreJobVetoed(schdCtxt, trigger, jobDetail, instCode);
                    return true;
                }
                catch (JobPersistenceException jpe)
                {
                    qs.NotifySchedulerListenersError(
                            string.Format(CultureInfo.InvariantCulture, "An error occured while marking executed job vetoed. job= '{0}'", jobDetail.FullName), jpe);
                }
                catch (ThreadInterruptedException)
                {
                }
            }
            return false;
        }
开发者ID:kisflying,项目名称:kion,代码行数:29,代码来源:JobRunShell.cs

示例11: TriggeredJobComplete

        public void TriggeredJobComplete(Trigger trigger, IScheduledJob job, SchedulerInstruction triggerInstCode)
        {
            lock (_triggerLock)
            {
                JobWrapper jw = _jobsDictionary[job.Name] as JobWrapper;
                TriggerWrapper tw = _triggersDictionary[trigger.Name] as TriggerWrapper;

                // even if it was deleted, there may be cleanup to do
                _blockedJobs.Remove(job.Name);

                // check for trigger deleted during execution...
                if (tw != null)
                {
                    if (triggerInstCode == SchedulerInstruction.DeleteTrigger)
                    {
                        //log.Debug("Deleting trigger");
                        NullableDateTime d = trigger.GetNextFireTimeUtc();
                        if (!d.HasValue)
                        {
                            // double check for possible reschedule within job 
                            // execution, which would cancel the need to delete...
                            d = tw.Trigger.GetNextFireTimeUtc();
                            if (!d.HasValue)
                            {
                                RemoveTrigger(trigger.Name);
                            }
                            else
                            {
                                log.Debug("Deleting cancelled - trigger still active");
                            }
                        }
                        else
                        {
                            RemoveTrigger(trigger.Name);
                        }
                    }
                    else if (triggerInstCode == SchedulerInstruction.SetTriggerComplete)
                    {
                        tw.State = InternalTriggerState.Complete;
                        _timeTriggers.Remove(tw);
                    }
                    else if (triggerInstCode == SchedulerInstruction.SetTriggerError)
                    {
                        log.Info(string.Format(CultureInfo.InvariantCulture, "Trigger {0} set to ERROR state.", trigger.Name));
                        tw.State = InternalTriggerState.Error;
                    }
                    else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersError)
                    {
                        log.Info(string.Format(CultureInfo.InvariantCulture, "All triggers of Job {0} set to ERROR state.", trigger.Name));
                        SetAllTriggersOfJobToState(trigger.Name, InternalTriggerState.Error);
                    }
                    else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersComplete)
                    {
                        SetAllTriggersOfJobToState(trigger.Name, InternalTriggerState.Complete);
                    }
                }
            }
        }
开发者ID:ResQue1980,项目名称:LoLTeamChecker,代码行数:58,代码来源:SchedulingService.cs

示例12: TriggerComplete

 public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
 {
     Write("{0} -- {1} -- Trigger ({2}) completed", Name, DateTime.Now, trigger.Key);
 }
开发者ID:cknightdevelopment,项目名称:CodeIn60Seconds,代码行数:4,代码来源:TriggerListener.cs

示例13: NotifyJobStoreJobComplete

 /// <summary>
 /// Notifies the job store job complete.
 /// </summary>
 /// <param name="trigger">The trigger.</param>
 /// <param name="detail">The detail.</param>
 /// <param name="instCode">The instruction code.</param>
 public virtual void NotifyJobStoreJobComplete(IOperableTrigger trigger, IJobDetail detail, SchedulerInstruction instCode)
 {
     resources.JobStore.TriggeredJobComplete(trigger, detail, instCode);
 }
开发者ID:NathanBaulch,项目名称:quartznet,代码行数:10,代码来源:QuartzScheduler.cs

示例14: TriggeredJobCompleteCallback

 public TriggeredJobCompleteCallback(JobStoreSupport js, SchedulingContext ctxt, Trigger trigger,
                                     SchedulerInstruction triggerInstCode, JobDetail jobDetail)
     : base(js)
 {
     this.ctxt = ctxt;
     this.trigger = trigger;
     this.triggerInstCode = triggerInstCode;
     this.jobDetail = jobDetail;
 }
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:9,代码来源:JobStoreSupport.cs

示例15: TriggeredJobComplete

 /// <summary>
 /// Inform the <see cref="IJobStore" /> that the scheduler has completed the
 /// firing of the given <see cref="Trigger" /> (and the execution its
 /// associated <see cref="IJob" />), and that the <see cref="JobDataMap" />
 /// in the given <see cref="JobDetail" /> should be updated if the <see cref="IJob" />
 /// is stateful.
 /// </summary>
 public virtual void TriggeredJobComplete(SchedulingContext ctxt, Trigger trigger, JobDetail jobDetail,
                                          SchedulerInstruction triggerInstCode)
 {
     ExecuteInNonManagedTXLock(LockTriggerAccess,
                               new TriggeredJobCompleteCallback(this, ctxt, trigger, triggerInstCode, jobDetail));
 }
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:13,代码来源:JobStoreSupport.cs


注:本文中的SchedulerInstruction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。