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


Java FileChangedReloadingStrategy类代码示例

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


FileChangedReloadingStrategy类属于org.apache.commons.configuration.reloading包,在下文中一共展示了FileChangedReloadingStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initConfig

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
private boolean initConfig() {
    if (fileConfigs.isEmpty()) {
        try {
            for (FileConfigurationBuilder fileConfigBuilder : fileConfigBuilders) {
                FileConfiguration fileConfig = fileConfigBuilder.getConfiguration();
                FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy();
                reloadingStrategy.setRefreshDelay(0);
                fileConfig.setReloadingStrategy(reloadingStrategy);
                fileConfigs.add(fileConfig);
            }
        } catch (ConfigurationException ex) {
            if (!fileNotFound(ex)) {
                LOG.error("Config init failed {}", ex);
            }
        }
    }
    return !fileConfigs.isEmpty();
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:19,代码来源:ConfigurationSubscription.java

示例2: ActivecheckPlugin

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
public ActivecheckPlugin(PropertiesConfiguration properties) {
    Validate.notNull(properties);
    this.properties = (PropertiesConfiguration) properties.clone();

    // set members
    enabled = properties.getBoolean("enabled", enabled);
    if (properties.getFile() != null) {
        configFile = properties.getFile().getAbsolutePath();
        // configure reloading strategy for the configuration file
        // TODO: does that work?
        this.properties.setReloadingStrategy(new FileChangedReloadingStrategy());
    } else {
        configFile = null;
    }

    // configure listeners for the configuration
    this.properties.addConfigurationListener(this);
}
 
开发者ID:frederikhappel,项目名称:activecheck,代码行数:19,代码来源:ActivecheckPlugin.java

示例3: JForumConfig

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
public JForumConfig(ServletContext servletContext, SessionFactory sessionFactory) {
	this.sessionFactory = sessionFactory;
	this.setReloadingStrategy(new FileChangedReloadingStrategy());
	this.setDelimiterParsingDisabled(true);

	try {
		loadProps();
		if (servletContext != null) {
			setProperty(ConfigKeys.APPLICATION_PATH, servletContext.getRealPath(""));
		}
		loadDatabaseProperties();
		normalizeTemplateDirectory();
	}
	catch (Exception e) {
		throw new ForumException(e);
	}
}
 
开发者ID:eclipse123,项目名称:JForum,代码行数:18,代码来源:JForumConfig.java

示例4: createConfig

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
private static org.apache.commons.configuration.Configuration createConfig(final Path basePath) {
    final Path path = basePath.resolve("requisition.properties");

    // Raise wrapped file not found exception if the config file does not exist
    if (!Files.exists(path)) {
        throw new RuntimeException("Config file not found: " + path);
    }

    // Load system and file properties
    try {
        return new org.apache.commons.configuration.PropertiesConfiguration(path.toFile()) {
            {
                setThrowExceptionOnMissing(true);
                setReloadingStrategy(new FileChangedReloadingStrategy());
            }
        };

    } catch (final ConfigurationException ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:OpenNMS,项目名称:opennms-provisioning-integration-server,代码行数:22,代码来源:InstanceApacheConfiguration.java

示例5: open

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
@Override
public void open() throws IOException {
	if (isOpen() || (configName == null)) {
		return;
	}
	try {
		initConfig();
		if (refDelay > 0) {
			FileChangedReloadingStrategy reloadConfig = new FileChangedReloadingStrategy();
			reloadConfig.setRefreshDelay(refDelay);
			config.setReloadingStrategy(reloadConfig);
		}
	} catch (Throwable e) {
		IOException ioe = new IOException(e.toString());
		ioe.initCause(e);
		throw ioe;
	}
}
 
开发者ID:Nastel,项目名称:TNT4J,代码行数:19,代码来源:FileTokenRepository.java

示例6: load

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
/**
 * Load the current system configuration file. The file is automatically reloaded if changed.
 * 
 * @return configuration
 */
public synchronized org.apache.commons.configuration.Configuration load() {
    if (!isLoaded) {
        try {
            config.load(System.getProperty(CONFIG_LOCATION_PROPERTY, filename));
            config.setReloadingStrategy(new FileChangedReloadingStrategy());

            isLoaded = true;
        }
        catch (ConfigurationException e) {
            LOG.error(System.getProperty(CONFIG_LOCATION_PROPERTY, filename));
            LOG.error("Unable to locate the DATUP configuration file in the (1) current directory or (2) classpath.",
                e);
    }
    }
    return config;
}
 
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:22,代码来源:Configuration.java

示例7: contextInitialized

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的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

示例8: contextInitialized

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的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

示例9: getConfiguration

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的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

示例10: Configuration

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private Configuration() throws ConfigurationException {
    AbstractConfiguration.setDelimiter('&');
    config = new XMLConfiguration(configPath);
    config.setReloadingStrategy(new FileChangedReloadingStrategy());
    metadataConfigurationManager = new MetadataConfigurationManager(this);
    namespaces = new HashMap<>();
    initNamespaces();
}
 
开发者ID:intranda,项目名称:goobi-viewer-indexer,代码行数:10,代码来源:Configuration.java

示例11: ConfigManagerUtil

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
private ConfigManagerUtil(String configFileName) {
    try {
        this.config = null;
        if (configFileName.toLowerCase().endsWith("xml")) {
            this.config = new XMLConfiguration(configFileName);
        } else if (configFileName.toLowerCase().endsWith("properties")) {
            this.config = new PropertiesConfiguration(configFileName);
        }
        this.config.setReloadingStrategy(new FileChangedReloadingStrategy());
        hashMap.put(configFileName, this);
    } catch (Exception e) {
    	e.printStackTrace();
    }
}
 
开发者ID:xnx3,项目名称:xnx3,代码行数:15,代码来源:ConfigManagerUtil.java

示例12: PlatformConfiguration

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
private PlatformConfiguration(){
	try {
		config = new PropertiesConfiguration("platform.properties");
		config.setReloadingStrategy(new FileChangedReloadingStrategy());			
	} catch (ConfigurationException e) {
		e.printStackTrace();
	}  
}
 
开发者ID:summerDp,项目名称:dpCms,代码行数:9,代码来源:PlatformConfiguration.java

示例13: parseConfig

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
/**
 * @author Wasiq B
 * @throws ConfigurationException
 * @throws FileNotFoundException
 * @since 04-Jul-2015 6:17:05 pm
 */
private void parseConfig () throws ConfigurationException, FileNotFoundException {
	String file = getString (Constants.TEST_CONFIG_FILE);
	if (file == null) {
		file = "test.properties";
	}
	final URL url = FileUtils.getResource (file);
	if (url == null) throw new FileNotFoundException (file);
	this.prop = new PropertiesConfiguration (url);
	this.prop.setAutoSave (true);
	this.prop.setReloadingStrategy (new FileChangedReloadingStrategy ());
	addConfiguration (this.prop);
}
 
开发者ID:WasiqB,项目名称:xtesy-framework,代码行数:19,代码来源:Settings.java

示例14: TajoSystemMetrics

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
public TajoSystemMetrics(TajoConf tajoConf, Class clazz, String hostAndPort) {
  super(MetricsUtil.getGroupName(clazz));

  this.hostAndPort = hostAndPort;
  try {
    this.metricsPropertyFileName = tajoConf.getVar(TajoConf.ConfVars.METRICS_PROPERTY_FILENAME);
    this.metricsProps = new PropertiesConfiguration(metricsPropertyFileName);
    this.metricsProps.addConfigurationListener(new MetricsReloadListener());
    FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy();
    reloadingStrategy.setRefreshDelay(5 * 1000);
    this.metricsProps.setReloadingStrategy(reloadingStrategy);
  } catch (ConfigurationException e) {
    LOG.warn(e.getMessage(), e);
  }

  // PropertiesConfiguration fire configurationChanged after getXXX()
  // So neeaded calling getXXX periodically
  propertyChangeChecker = new Thread() {
    public void run() {
      while(!stop.get()) {
        String value = metricsProps.getString("reporter.file");
        try {
          Thread.sleep(10 * 1000);
        } catch (InterruptedException e) {
        }
      }
    }
  };

  propertyChangeChecker.start();
}
 
开发者ID:apache,项目名称:tajo,代码行数:32,代码来源:TajoSystemMetrics.java

示例15: TajoSystemMetrics

import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; //导入依赖的package包/类
public TajoSystemMetrics(TajoConf tajoConf, String metricsGroupName, String hostAndPort) {
  super(metricsGroupName);

  this.hostAndPort = hostAndPort;
  try {
    this.metricsPropertyFileName = tajoConf.getVar(TajoConf.ConfVars.METRICS_PROPERTY_FILENAME);
    this.metricsProps = new PropertiesConfiguration(metricsPropertyFileName);
    this.metricsProps.addConfigurationListener(new MetricsReloadListener());
    FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy();
    reloadingStrategy.setRefreshDelay(5 * 1000);
    this.metricsProps.setReloadingStrategy(reloadingStrategy);
  } catch (ConfigurationException e) {
    LOG.warn(e.getMessage(), e);
  }

  //PropertiesConfiguration fire configurationChanged after getXXX()
  //So neeaded calling getXXX periodically
  propertyChangeChecker = new Thread() {
    public void run() {
      while(!stop.get()) {
        String value = metricsProps.getString("reporter.file");
        try {
          Thread.sleep(10 * 1000);
        } catch (InterruptedException e) {
        }
      }
    }
  };

  propertyChangeChecker.start();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:32,代码来源:TajoSystemMetrics.java


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