List of usage examples for org.apache.commons.configuration Configuration getLong
long getLong(String key);
From source file:org.ublog.benchmark.social.SocialBenchmark.java
@Override public void initialize(Configuration conf) throws ConfigurationException { this.initialTweetsFactor = conf.getDouble("benchmark.social.initialTweetsFactor"); Utils.MAX_MESSAGES_IN_TIMELINE = conf.getInt("benchmark.social.maximumMessagesTimeline"); Utils.MaxNTweets = conf.getInt("benchmark.social.maximumTweetsPerUser"); long seedNextOperation = conf.containsKey("benchmark.social.seedNextOperation") ? conf.getLong("benchmark.social.seedNextOperation") : System.nanoTime();/*from w ww . jav a 2 s. c om*/ long seedOwner = conf.containsKey("benchmark.social.seedOwner") ? conf.getLong("benchmark.social.seedOwner") : System.nanoTime(); long seedTopic = conf.containsKey("benchmark.social.seedTopic") ? conf.getLong("benchmark.social.seedTopic") : System.nanoTime(); long seedStartFollow = conf.containsKey("benchmark.social.seedStartFollow") ? conf.getLong("benchmark.social.seedStartFollow") : System.nanoTime(); this.rndOp = new Random(seedNextOperation); this.rndOwner = new Random(seedOwner); this.rndTopic = new Random(seedTopic); this.rndStartFollow = new Random(seedStartFollow); this.probabilitySearchPerTopic = conf.getDouble("benchmark.social.probabilities.probabilitySearchPerTopic"); this.probabilitySearchPerOwner = conf.getDouble("benchmark.social.probabilities.probabilitySearchPerOwner"); this.probabilityGetRecentTweets = conf .getDouble("benchmark.social.probabilities.probabilityGetRecentTweets"); this.probabilityGetFriendsTimeline = conf .getDouble("benchmark.social.probabilities.probabilityGetFriendsTimeline"); this.probabilityStartFollowing = conf.getDouble("benchmark.social.probabilities.probabilityStartFollowing"); this.probabilityStopFollowing = conf.getDouble("benchmark.social.probabilities.probabilityStopFollowing"); if (this.probabilityGetFriendsTimeline + this.probabilityGetRecentTweets + this.probabilitySearchPerOwner + this.probabilitySearchPerTopic + this.probabilityStartFollowing + this.probabilityStopFollowing > 1) { logger.warn("The sum of all probabilities must be less or equal than 1."); throw new ConfigurationException("The sum of all probabilities must be less or equal than 1."); } String serverName = conf.getString("benchmark.server.name"); int serverPort = conf.getInt("benchmark.server.port"); this.remoteGraphServer = this.getRemoteGraphServer(serverName, serverPort); try { this.hasInitiated = this.remoteGraphServer.init(this.totalSize); } catch (RemoteException e) { e.printStackTrace(); } }
From source file:org.wso2.andes.server.store.SlowMessageStore.java
public void configureConfigStore(String name, ConfigurationRecoveryHandler recoveryHandler, Configuration config, LogSubject logSubject) throws Exception { //To change body of implemented methods use File | Settings | File Templates. _logger.info("Starting SlowMessageStore on Virtualhost:" + name); Configuration delays = config.subset(DELAYS); configureDelays(delays);// w w w.j av a2 s .c o m String messageStoreClass = config.getString("realStore"); if (delays.containsKey(DEFAULT_DELAY)) { _defaultDelay = delays.getLong(DEFAULT_DELAY); } if (messageStoreClass != null) { Class clazz = Class.forName(messageStoreClass); Object o = clazz.newInstance(); if (!(o instanceof MessageStore)) { throw new ClassCastException("Message store class must implement " + MessageStore.class + ". Class " + clazz + " does not."); } _realStore = (MessageStore) o; _realStore.configureConfigStore(name, recoveryHandler, config, logSubject); } else { _realStore.configureConfigStore(name, recoveryHandler, config, logSubject); } }
From source file:org.wso2.andes.server.store.SlowMessageStore.java
private void configureDelays(Configuration config) { Iterator delays = config.getKeys(); while (delays.hasNext()) { String key = (String) delays.next(); if (key.endsWith(PRE)) { _preDelays.put(key.substring(0, key.length() - PRE.length() - 1), config.getLong(key)); } else if (key.endsWith(POST)) { _postDelays.put(key.substring(0, key.length() - POST.length() - 1), config.getLong(key)); }/* ww w . j av a2 s . co m*/ } }
From source file:uk.co.gidley.jmxmonitor.services.ThreadManager.java
private void initialiseMonitoringGroup(String groupName, Configuration config) throws InitialisationException { String monitorFile = config.getString(PROPERTY_PREFIX + groupName + ".monitorConfiguration"); String expressionFile = config.getString(PROPERTY_PREFIX + groupName + ".expressionConfiguration"); Long interval = config.getLong(PROPERTY_PREFIX + groupName + ".interval"); File monitor = findConfigurationFile(monitorFile); File expression = findConfigurationFile(expressionFile); MonitoringGroup monitoringGroup = new MonitoringGroup(); monitoringGroup.initialise(groupName, monitor, expression, interval); Thread thread = new Thread(threadGroup, monitoringGroup, groupName); monitoringGroups.put(groupName, new MonitoringGroupHolder(monitoringGroup, thread)); }