HTML5技术

使用sqlserver搭建高可用双机热备的Quartz集群部署【附源码】 - 一线码农(3)

字号+ 作者:H5之家 来源:H5之家 2017-05-29 13:01 我要评论( )

Initialize() 2 { (cfg != null ) 5 { 6 return ; 7 } 8 if (initException != null ) 9 { 10 throw initException; 11 } 12 13 NameValueCollection props = (NameValueCollection) ConfigurationManager.GetSecti

Initialize() 2 { (cfg != null) 5 { 6 return; 7 } 8 if (initException != null) 9 { 10 throw initException; 11 } 12 13 NameValueCollection props = (NameValueCollection) ConfigurationManager.GetSection(ConfigurationSectionName); requestedFile = QuartzEnvironment.GetEnvironmentVariable(PropertiesFile); 16 17 string propFileName = requestedFile != null && requestedFile.Trim().Length > 0 ? requestedFile : "~/quartz.config"; { 22 propFileName = FileUtil.ResolveFile(propFileName); 23 } 24 catch (SecurityException) 25 { ); ; 28 } (props == null && File.Exists(propFileName)) 31 { { 35 PropertiesParser pp = PropertiesParser.ReadFromFileResource(propFileName); 36 props = pp.UnderlyingProperties; , propFileName)); 38 } 39 catch (Exception ex) 40 { .FormatInvariant(propFileName, ex.Message), ex); 42 } 43 44 } 45 if (props == null) 46 { { ); 51 props = pp.UnderlyingProperties; ); 53 } 54 catch (Exception ex) 55 { .FormatInvariant(ex.Message), ex); 57 } 58 } 59 if (props == null) 60 { SchedulerConfigException( 62 @"Could not find <quartz> configuration section from your application config or load default configuration from assembly. ); 64 } 65 Initialize(OverrideWithSysProps(props)); 66 }

     

     仔细阅读上面的一串代码,你会发现,默认quartz参数配置来源于三个地方。

1. app.config中的section节点。

2. bin目录下的~/quartz.config文件。

3. 默认配置的NameValueCollection字典集合,也就是上一篇博客给大家做的一个演示。

   

     我个人不怎么喜欢通过quartz.config文件进行配置,这样也容易写死,所以我还是喜欢使用最简单的NameValueCollection配置,因为它的数据源可来源

于第三方存储结构中,配置代码如下:

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • localstorage和sessionstorage上手使用记录 - 蓓蕾心晴

    localstorage和sessionstorage上手使用记录 - 蓓蕾心晴

    2017-05-24 09:00

  • TensorFlowSharp入门使用C#编写TensorFlow人工智能应用 - LineZero

    TensorFlowSharp入门使用C#编写TensorFlow人工智能应用 - LineZero

    2017-05-24 08:00

  • .net 企业管理系统快速搭建框架 - 请求

    .net 企业管理系统快速搭建框架 - 请求

    2017-05-22 18:06

  • 使用three.js实现机器人手臂的运动效果 - faker_archer

    使用three.js实现机器人手臂的运动效果 - faker_archer

    2017-05-21 14:02

网友点评
/