List of usage examples for java.util.concurrent ConcurrentHashMap ConcurrentHashMap
public ConcurrentHashMap()
From source file:com.krawler.portal.util.SystemProperties.java
private SystemProperties() { Properties p = new Properties(); ClassLoader classLoader = getClass().getClassLoader(); // system.properties try {/* w w w.j a v a 2s.c o m*/ URL url = classLoader.getResource("system.properties"); if (url != null) { InputStream is = url.openStream(); p.load(is); is.close(); logger.debug("Loading " + url); } } catch (Exception e) { logger.warn(e.getMessage(), e); } // system-ext.properties try { URL url = classLoader.getResource("system-ext.properties"); if (url != null) { InputStream is = url.openStream(); p.load(is); is.close(); logger.debug("Loading " + url); } } catch (Exception e) { logger.warn(e.getMessage(), e); } // Set environment properties SystemEnv.setProperties(p); // Set system properties boolean systemPropertiesLoad = GetterUtil.getBoolean(System.getProperty(SYSTEM_PROPERTIES_LOAD), true); boolean systemPropertiesFinal = GetterUtil.getBoolean(System.getProperty(SYSTEM_PROPERTIES_FINAL), true); if (systemPropertiesLoad) { Enumeration<String> enu = (Enumeration<String>) p.propertyNames(); while (enu.hasMoreElements()) { String key = enu.nextElement(); if (systemPropertiesFinal || Validator.isNull(System.getProperty(key))) { System.setProperty(key, p.getProperty(key)); } } } _props = new ConcurrentHashMap<String, String>(); // Use a fast concurrent hash map implementation instead of the slower // java.util.Properties PropertiesUtil.fromProperties(p, _props); }