/** * Set value for property bound to the current thread context class loader. * @param propertyName property name * @param value property value. If null, remove the property. * @param isDefault determines if property is default or not. * A non-default property cannot be overriden. * A default property can be overriden by a property * (default or non-default) of the same name bound to * a decendent class loader. */ public static void setProperty(String propertyName, String value, boolean isDefault) { if (propertyName != null) { synchronized (propertiesCache) { ClassLoader classLoader = getThreadContextClassLoader(); Map<String, Value> properties = propertiesCache.get(classLoader); if (value == null) { if (properties != null) { properties.remove(propertyName); } } else { if (properties == null) { properties = new HashMap<String, Value>(); propertiesCache.put(classLoader, properties); } properties.put(propertyName, new Value(value, isDefault)); } } } }