当前位置: 首页 > news >正文

南京公司网站建设怎么收费网站图标文件下载

南京公司网站建设怎么收费,网站图标文件下载,wordpress网站设密码,旅游网站建设成都跟[一线码农大佬]翻译的某技术文对个线最近看到一线码农大佬翻译的《如何在 ASP.NET Core 中使用 Quartz.NET 执行任务调度》#xff0c;行文思路#xff1a;安装Quartz.NETQuartz.NET 中的Job,triggers 和 Schedulers创建 Scheduler开启和停止 scheduler创建 job 工厂创建 J… 跟[一线码农大佬]翻译的某技术文对个线最近看到一线码农大佬翻译的《如何在 ASP.NET Core 中使用 Quartz.NET 执行任务调度》行文思路安装Quartz.NETQuartz.NET 中的Job,triggers 和 Schedulers创建 Scheduler开启和停止 scheduler创建 job 工厂创建 JobMetadata 存储你的 job 元数据不可否认一线大佬的翻译文还是相当精准的 但个人认为这篇文章的底稿有点硬输出并没有以一个流畅、直观的编码思路来讲述[如何在ASP.NET Core中使用Quartz.NET 执行定时任务]。尤其是下面这段想起我之前也写了《ASP.NET CoreQuartz.Net实现web定时任务》 文章以一个简单的定时任务讲述了Quartz.NET在ASP.NET Core中的应用思路遇河架桥,遇山开路。这里我要解释一下上图中为什么要自定义一个Job工厂先看下官方JobFactory的作用大意是说如果某触发器被触发该触发器关联的Job将被调度器上配置的JobFactory初始化Quartz.NET默认的SimpleJobFactory工厂类是利用反射无参构造函数构造出Job实例。翻源码//----------------选自Quartz.Simpl.SimpleJobFactory类------------- using System; using Quartz.Logging; using Quartz.Spi; using Quartz.Util; namespace Quartz.Simpl {/// summary /// The default JobFactory used by Quartz - simply calls /// see crefObjectUtils.InstantiateType{T} / on the job class./// /summary/// seealso crefIJobFactory //// seealso crefPropertySettingJobFactory //// authorJames House/author/// authorMarko Lahma (.NET)/authorpublic class SimpleJobFactory : IJobFactory{private static readonly ILog log  LogProvider.GetLogger(typeof (SimpleJobFactory));/// summary/// Called by the scheduler at the time of the trigger firing, in order to/// produce a see crefIJob / instance on which to call Execute./// /summary/// remarks/// It should be extremely rare for this method to throw an exception -/// basically only the case where there is no way at all to instantiate/// and prepare the Job for execution.  When the exception is thrown, the/// Scheduler will move all triggers associated with the Job into the/// see crefTriggerState.Error / state, which will require human/// intervention (e.g. an application restart after fixing whatever/// configuration problem led to the issue with instantiating the Job)./// /remarks/// param namebundleThe TriggerFiredBundle from which the see crefIJobDetail ////   and other info relating to the trigger firing can be obtained./param/// param namescheduler/param/// returnsthe newly instantiated Job/returns/// throws  SchedulerException if there is a problem instantiating the Job. /throwspublic virtual IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler){IJobDetail jobDetail  bundle.JobDetail;Type jobType  jobDetail.JobType;try{if (log.IsDebugEnabled()){log.Debug($Producing instance of Job {jobDetail.Key}, class{jobType.FullName});}return ObjectUtils.InstantiateTypeIJob(jobType);}catch (Exception e){SchedulerException se  new SchedulerException($Problem instantiating class {jobDetail.JobType.FullName}, e);throw se;}}/// summary/// Allows the job factory to destroy/cleanup the job if needed. /// No-op when using SimpleJobFactory./// /summarypublic virtual void ReturnJob(IJob job){var disposable  job as IDisposable;disposable?.Dispose();}} }//------------------节选自Quartz.Util.ObjectUtils类-------------------------public static T InstantiateTypeT(Type type) {if (type  null){throw new ArgumentNullException(nameof(type), Cannot instantiate null);}ConstructorInfo ci  type.GetConstructor(Type.EmptyTypes);if (ci  null){throw new ArgumentException(Cannot instantiate type which has no empty constructor, type.Name);}return (T) ci.Invoke(new object[0]); } 但是很多情况下我们定义的Job很可能依赖第三方服务就比如一线大佬文中NotificationJob依赖了ILoggerNotificationJob 服务。这样默认的SimpleJobFactory不能满足实例化要求 考虑将Job任务作为依赖注入组件加入依赖注入容器。关键思路IScheduler 开放了JobFactory 属性便于你应用自定义的Job工厂在自定义Job工厂中使用ASP.NET Core依赖注入容器IServiceProvider解析出特定的Job。JobFactories may be of use to those wishing to have their application produce IJob instances via some special mechanism, such as to give the opportunity for dependency injection这才有一线码农大佬原文 [创建Job工厂类]动作的由来,  知其然更知其所以然如有勘误欢迎留言赐教。Reference: ASP.NET CoreQuartz.Net实现web定时任务
http://www.huolong8.cn/news/228571/

相关文章:

  • 网站正在建设中 html可信赖的手机网站建设
  • 蜘蛛网是个什么网站辽宁城市建设职业技术学院教育网站
  • 做微信网站的公司无代码开发平台全免费
  • 任何做网站国外产品设计网
  • 网站做线上销售湖北做网站平台哪家好
  • 织梦的手机端网站模板下载地址长沙手机网站设计公司
  • dw做网站需要数据库么留言 wordpress
  • 为您打造高端品牌网站门户网站的含义
  • 河北省建设厅办事大厅网站学校语言文字网站建设
  • 搜索引擎是软件还是网站哪里可以做购物网站
  • 网站开发分哪几个步骤大健康品牌策划公司
  • 天助网的网站哈尔滨建工建设有限公司
  • 汕头网站建设推荐h5制作工具免费版
  • 东莞网站建设 旅游网页游戏魔域永恒魔石
  • 微网站模板标签wordpress建站网页无法运作
  • 和佳网站建设网站开发人员是做什么的
  • php网站建设教程济南咨询行业网站开发
  • 江苏住房和城乡建设信息网站嵌入式软件开发要求
  • 自己做的网站跳转到购彩大厅wordpress 技术文档
  • 北京市建设监理协会网站php 手机网站 模板
  • 如何做网站的关键词网站建设小公司生存
  • 网站开发前景咋样设计图片用什么软件好
  • 连云港seo网站推广手机浏览器
  • 支付网站怎么做网站开发的项目需求
  • 福州市工程建设质量管理协会网站wordpress 设置首页
  • 动易学校网站帕兰映像 wordpress
  • 网站上面的水印怎么做贵南县wap网站建设公司
  • 福州建设人才网站南京网站建设开发
  • 建设网站需要给钱吗品牌建设有哪些方面
  • 网站建设高等教育出版社外贸seo网站推广公司