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


C# Quartz.JobExecutionContext类代码示例

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


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

示例1: Execute

 public void Execute(JobExecutionContext context)
 {
     try
     {
         log.Info("AllListJob开始更新");
         var videos = ListCache.Instance.Items[new VideoNodeKey(null, 0, null)].Ver1;
         var root = new XElement("vlist");
         int num = 0;
         foreach (var video in videos)
         {
             root.Add(ResponseUtils.ResponseBack(ListCache.Instance.Dictionary[video]));
             num++;
         }
         root.AddFirst(new XElement("count", num));
         ResponseUtils.SaveXml("all.xml", root);
         YesterdayListCache.Instance.Refresh(videos);
         SerizlizerUtils<YesterdayVideoNode>.SerializeSplitCache(YesterdayListCache.Instance.Items, _buffername);
         //SerizlizerUtils<VideoNode>.SerializeSplitCache(videos, _buffername);
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     finally
     {
         log.Info("AllListJob结束更新");
     }
 }
开发者ID:uvbs,项目名称:MyProjects,代码行数:28,代码来源:AllListJob.cs

示例2: Execute

 public void Execute(JobExecutionContext context)
 {
     try
     {
         int taskid = Convert.ToInt32(context.JobDetail.Name);
         var taskruntimeinfo = TaskPoolManager.CreateInstance().Get(taskid.ToString());
         if (taskruntimeinfo == null || taskruntimeinfo.DllTask == null)
         {
             LogHelper.AddTaskError("当前任务信息为空引用", taskid, new Exception());
             return;
         }
         taskruntimeinfo.TaskLock.Invoke(() => {
             try
             {
                 taskruntimeinfo.DllTask.TryRun();
             }
             catch (Exception exp)
             {
                 LogHelper.AddTaskError("任务" + taskid + "TaskJob回调时执行失败", taskid, exp);
             }
         });
        
     }
     catch (Exception exp)
     {
         LogHelper.AddNodeError("任务回调时严重系统级错误", exp);
     }
 }
开发者ID:zeus911,项目名称:Dyd.BaseService.TaskManager,代码行数:28,代码来源:TaskJob.cs

示例3: Execute

        public virtual void Execute(JobExecutionContext context)
        {
            Logger = new ServiceLogger(context.JobDetail.Name);

            if (Monitor.TryEnter(SYNC_LOCK, 3000) == false)
            {
                Logger.Debug("上一次调度未完成,本次调度放弃运行");
                return;
            }

            try
            {
                Logger.Info("调度开始执行");

                InnerExecute(context);

                Logger.Info("调度正常结束");
            }
            catch (Exception e)
            {
                Logger.Error("调度执行时发生异常: " + e);
            }
            finally
            {
                Monitor.Exit(SYNC_LOCK);
            }
        }
开发者ID:tianma8778,项目名称:QuartzService,代码行数:27,代码来源:BaseJob.cs

示例4: Execute

        public void Execute(JobExecutionContext context)
        {
            var payments = _ctx.Messages.Where(p => p.MessageStatus == Domain.MessageStatus.Pending);
            int numberOfDaysOpenThreshold = 10;
            foreach (var payment in payments)
            {
                var transactionBatch = transactionBatchService.GetOpenBatch();

                if (payment.CreateDate.AddDays(numberOfDaysOpenThreshold).Date > System.DateTime.Now.Date)
                {
                    //Create a transaction to deposit payment amount in payer's account
                    payment.Transactions.Add(new Domain.Transaction()
                    {
                        Amount = payment.Amount,
                        Category = Domain.TransactionCategory.Payment,
                        CreateDate = System.DateTime.Now,
                        FromAccountId = payment.SenderAccountId.Value,
                        PaymentChannelType = Domain.PaymentChannelType.Single,
                        //PaymentId = payment.Id,
                        StandardEntryClass = Domain.StandardEntryClass.Web,
                        Status = Domain.TransactionStatus.Pending,
                        TransactionBatchId = transactionBatch.Id,
                        Type = Domain.TransactionType.Deposit
                    });
                }
            }
        }
开发者ID:SomeHero,项目名称:SocialPayments,代码行数:27,代码来源:ProcessOpenPaymentJob.cs

示例5: JobWasExecuted

 public void JobWasExecuted(JobExecutionContext context, JobExecutionException jobException)
 {
     if(jobException == null)
         _jobs.Update(new { Status = "Complete",  RunTimeMinutes = Math.Round(context.JobRunTime.TotalMinutes, 2)}, context.JobDetail.JobDataMap["QueueID"]);
     else
         _jobs.Update(new { Status = "Error", RunTimeMinutes = Math.Round(context.JobRunTime.TotalMinutes, 2) }, context.JobDetail.JobDataMap["QueueID"]);
 }
开发者ID:gerardo-flores,项目名称:Shell,代码行数:7,代码来源:QueueUpdateManager.cs

示例6: Execute

        public void Execute(JobExecutionContext context)
        {
            JobDataMap map = context.MergedJobDataMap;

            ScheduleQuery details = (ScheduleQuery) map["Details"];

            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings[details.DatabaseName];
            if (connectionStringSettings != null)
            {
                var nextRunDate = GetNextRunDate(context.Trigger);
                AdoTemplate template = CreateTemplate(connectionStringSettings);
                DateTime startTime = DateTime.Now;
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                try
                {
                    int numResults = RunQuery(template, details.QueryText);
                    stopwatch.Stop();
                    PublishSuccessEvent(details, numResults, startTime, nextRunDate, stopwatch.Elapsed);
                } catch (Exception ex)
                {
                    PublishFailEvent(details, startTime, nextRunDate, ex);
                }
            }
        }
开发者ID:ETK,项目名称:SqlMonitor,代码行数:25,代码来源:QueryRunner.cs

示例7: Execute

 public void Execute(JobExecutionContext context)
 {
     try
     {
         if (!NetNodeService.Instance.IsRefresh)
         {
             _logger.Info("缓存未更新,连接数据库同步数据");
             ListCacheJob job = new ListCacheJob();
             job.Execute(context);
         }
         else
         {
             _logger.Info("缓存已更新");
             NetNodeService.Instance.IsRefresh = false;
         }
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
     }
     finally
     {
         _logger.Info("MonitorListJob结束更新");
     }
 }
开发者ID:uvbs,项目名称:MyProjects,代码行数:25,代码来源:MonitorListJob.cs

示例8: Execute

 public void Execute(JobExecutionContext context)
 {
     Debugger.Break();
     var action = context.MergedJobDataMap["action"] as Action;
     if (action != null)
         action();
 }
开发者ID:teamaton,项目名称:speak-lib,代码行数:7,代码来源:JobBase.cs

示例9: ExecuteInternal

 /// <summary>
 /// Invoke the method via the MethodInvoker.
 /// </summary>
 /// <param name="context"></param>
 protected override void ExecuteInternal(JobExecutionContext context)
 {
     if (methodInvoker == null)
     {
         throw new JobExecutionException("Could not execute job when method invoker is null");
     }
     try
     {
         context.Result = methodInvoker.Invoke();
     }
     catch (TargetInvocationException ex)
     {
         logger.Error(errorMessage, ex.GetBaseException());
         if (ex.GetBaseException() is JobExecutionException)
         {
             // -> JobExecutionException, to be logged at info level by Quartz
             throw ex.GetBaseException();
         }
         // -> "unhandled exception", to be logged at error level by Quartz
         throw new JobMethodInvocationFailedException(methodInvoker, ex.GetBaseException());
     }
     catch (Exception ex)
     {
         // -> "unhandled exception", to be logged at error level by Quartz
         throw new JobMethodInvocationFailedException(methodInvoker, ex.GetBaseException());   
     }
 }
开发者ID:fuadm,项目名称:spring-net,代码行数:31,代码来源:MethodInvokingJob.cs

示例10: Execute

        public void Execute(JobExecutionContext context)
        {
            try
            {
                var message = "The quick brown fox jumps over the lazy dog.";

                if (Log.IsInfoEnabled)
                {
                    Log.Info(message);
                }
                else
                {
                    Console.WriteLine(message);
                }
            }
            catch (JobExecutionException exception)
            {
                var message = string.Format("Quartz.NET Job error: {0}", exception.Message);

                if (!Log.IsErrorEnabled)
                {
                    Log.Error(message);
                }
                else
                {
                    Console.WriteLine(message);
                }

                Console.WriteLine("Press any key to continue . . .");
                Console.ReadKey(true);
            }
        }
开发者ID:nanotaboada,项目名称:dotnet,代码行数:32,代码来源:CronJob.cs

示例11: Execute

 /// <summary>
 /// Entry point called when trigger fires.
 /// </summary>
 /// <param name="context"></param>
 public void Execute(JobExecutionContext context)
 {
     var settings = Load(context);
     
     try
     {
         foreach (var mdn in ExpiredMdns(settings))
         {
             using (TransactionScope scope = new TransactionScope())
             {
                 var message = CreateNotificationMessage(mdn, settings);
                 string filePath = Path.Combine(settings.PickupFolder, UniqueFileName());
                 MDNManager.TimeOut(mdn);
                 message.Save(filePath);
                 scope.Complete();
             }
         }
     }
     catch (Exception e)
     {
         Logger.Error("Error in job!");
         Logger.Error(e.Message);
         var je = new JobExecutionException(e);
         throw je;
     }
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:30,代码来源:MdnProcessedTimeout.cs

示例12: Execute

        public void Execute(JobExecutionContext context)
        {
            var footballDataRepository = new FootballDataRepository();
            LoadResults(footballDataRepository);

            LoadFixtures(footballDataRepository);
        }
开发者ID:AndrewJutton,项目名称:Score-Squid,代码行数:7,代码来源:ChampionshipJob.cs

示例13: Execute

 /// <summary>
 /// The execute.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public void Execute(JobExecutionContext context)
 {
     Ioc.SatisfyImportsOnce(this);
     Logger.Log(LogSeverity.Information, "CleanUpCallsManagerJob", "Clean up service executing");
     CleanUpTempFolder();
     CleanUpPaperClipFolder();
 }
开发者ID:mparsin,项目名称:Elements,代码行数:13,代码来源:CleanUpCallsManagerJob.cs

示例14: Execute

 public void Execute(JobExecutionContext context)
 {
     if (!Monitor.TryEnter(_lock))
         return;
     try
     {
         var dic = AppSettingCache.Instance.Dictionary;
         if (dic != null)
         {
             foreach (var process in dic)
             {
                 var count = Process.GetProcessesByName(process.Key).Length;
                 if (count <= 0)
                 {
                     if (System.IO.File.Exists(process.Value))
                     {
                         using (System.Diagnostics.Process.Start(process.Value))
                         { }
                         _log.InfoFormat("进程{0}不存在,重新启动", process.Key);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex);
     }
     finally
     {
         Monitor.Exit(_lock);
     }
 }
开发者ID:uvbs,项目名称:MyProjects,代码行数:33,代码来源:MonitorJob.cs

示例15: Execute

        public void Execute(JobExecutionContext context)
        {
            //The LogManager plugs into the Service's logger and gets it magically.
            //in test mode we have no logger, because we have no containing Service so it does nothing.
            ILog logger = LogManager.GetLogger(typeof(BirthDayJob));

            //Actual work below.
            try
            {
                //ds will contain rows with a single column: mail addresses.
                DataSet ds = SqlHelper.ExecuteDataset(connStr,
                                                      CommandType.Text,
                                                      "select user_email"+
                                                      " from personalcard inner join users"+
                                                      " on personalcard_user_id = user_id "+
                                                      "WHERE " + " DAY(personalcard_birth_day) = DATEPART(DAY,GETDATE()) " +
                                                      " and MONTH(personalcard_birth_day) = DATEPART(MONTH,GETDATE())");

                logger.Debug("found " + ds.Tables[0].Rows.Count + " emails to send birthday greetings to.");

                //make the result available for everyone.
                _result = ds;
            }
            catch (Exception ex)
            {
                logger.Error("could not make query: " + ex.Message);
            }
        }
开发者ID:jondot,项目名称:janitor,代码行数:28,代码来源:BirthDayJob.cs


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