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


Java PropertiesConfiguration.setReloadingStrategy方法代码示例

本文整理汇总了Java中org.apache.commons.configuration.PropertiesConfiguration.setReloadingStrategy方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConfiguration.setReloadingStrategy方法的具体用法?Java PropertiesConfiguration.setReloadingStrategy怎么用?Java PropertiesConfiguration.setReloadingStrategy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration.PropertiesConfiguration的用法示例。


在下文中一共展示了PropertiesConfiguration.setReloadingStrategy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contextInitialized

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    try {
        // 设定文件初期读入
        PropertiesConfiguration yiduConf = new PropertiesConfiguration("yidu.properties");
        // 设定文件自动更新
        FileChangedReloadingStrategy reloadStrategy = new FileChangedReloadingStrategy();
        yiduConf.setReloadingStrategy(reloadStrategy);
        YiDuConstants.yiduConf = yiduConf;

        // 加载伪原创设置
        YiDuConstants.pseudoConf = new PropertiesConfiguration("pseudo.properties");
        YiDuConstants.pseudoConf.setReloadingStrategy(reloadStrategy);

        // 初始化缓存
        CacheManager.initCacheManager();

        if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CACHE_ARTICLE_COUNT, false)) {
            // 初始化小说件数MAP
            ArticleCountManager.initArticleCountManager();
        }

        if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_SINGLE_BOOK, false)) {
            // 初始化小说拼音和编号映射件数MAP
            SingleBookManager.initSingleBookManager();
        }
        
        // 初始化分类信息MAP
        CategoryCacheManager.initCategoryCacheManager();

        logger.info("Initialize successfully.");
    } catch (Exception e) {
    	e.printStackTrace();
        logger.error(e.getMessage(), e);
    }
}
 
开发者ID:luckyyeah,项目名称:YiDu-Novel,代码行数:37,代码来源:InitializerListener.java

示例2: contextInitialized

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    try {
        // 设定文件初期读入
        PropertiesConfiguration yiduConf = new PropertiesConfiguration("yidu.properties");
        // 设定文件自动更新
        FileChangedReloadingStrategy reloadStrategy = new FileChangedReloadingStrategy();
        yiduConf.setReloadingStrategy(reloadStrategy);
        YiDuConstants.yiduConf = yiduConf;

        // 加载伪原创设置
        YiDuConstants.pseudoConf = new PropertiesConfiguration("pseudo.properties");
        YiDuConstants.pseudoConf.setReloadingStrategy(reloadStrategy);

        // 初始化缓存
        CacheManager.initCacheManager();

        if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_CACHE_ARTICLE_COUNT, false)) {
            // 初始化小说件数MAP
            ArticleCountManager.initArticleCountManager();
        }

        if (YiDuConstants.yiduConf.getBoolean(YiDuConfig.ENABLE_SINGLE_BOOK, false)) {
            // 初始化小说拼音和编号映射件数MAP
            SingleBookManager.initSingleBookManager();
        }
        
        // 初始化分类信息MAP
        CategoryCacheManager.initCategoryCacheManager();

        logger.info("Initialize successfully.");
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
    }
}
 
开发者ID:Chihpin,项目名称:Yidu,代码行数:36,代码来源:InitializerListener.java

示例3: getConfiguration

import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
private Configuration getConfiguration(String name) {
	Configuration configuration = null;
	URL url = Thread.currentThread().getContextClassLoader().getResource(name);
	if (url != null) {
		PropertiesConfiguration pc = new PropertiesConfiguration();
		pc.setURL(url);
		
		// Set reloading strategy 
		String dynamicReload = ApplicationProperties.getProperty("tmtbl.properties.dynamic_reload", null);
		if (dynamicReload!=null && dynamicReload.equalsIgnoreCase("true")) {
			long refreshDelay = Constants.getPositiveInteger(
					ApplicationProperties.getProperty("tmtbl.properties.dynamic_reload_interval"), 15000 );
			
			FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
			strategy.setRefreshDelay(refreshDelay); 
			pc.setReloadingStrategy(strategy);
			
			pc.addConfigurationListener(new MessageResourcesCfgListener(pc.getBasePath()));
		}			
		
		try {
			pc.load();
			configuration = pc;
		} catch (ConfigurationException e) {
			Debug.error("Message Resources configuration exception: " + e.getMessage());
		}
	}

	return configuration;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:31,代码来源:MessageResources.java


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