|
@@ -690,26 +690,26 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
*/
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public Configuration(Configuration other) {
|
|
|
- synchronized(other) {
|
|
|
- this.resources = (ArrayList<Resource>) other.resources.clone();
|
|
|
- if (other.properties != null) {
|
|
|
- this.properties = (Properties)other.properties.clone();
|
|
|
- }
|
|
|
-
|
|
|
- if (other.overlay!=null) {
|
|
|
- this.overlay = (Properties)other.overlay.clone();
|
|
|
- }
|
|
|
-
|
|
|
- this.updatingResource = new HashMap<String, String[]>(other.updatingResource);
|
|
|
- this.finalParameters = new HashSet<String>(other.finalParameters);
|
|
|
-
|
|
|
- this.classLoader = other.classLoader;
|
|
|
- this.loadDefaults = other.loadDefaults;
|
|
|
- setQuietMode(other.getQuietMode());
|
|
|
- }
|
|
|
+ this.resources = (ArrayList<Resource>) other.resources.clone();
|
|
|
+ synchronized(other) {
|
|
|
+ if (other.properties != null) {
|
|
|
+ this.properties = (Properties)other.properties.clone();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (other.overlay!=null) {
|
|
|
+ this.overlay = (Properties)other.overlay.clone();
|
|
|
+ }
|
|
|
+
|
|
|
+ this.updatingResource = new HashMap<String, String[]>(other.updatingResource);
|
|
|
+ this.finalParameters = new HashSet<String>(other.finalParameters);
|
|
|
+ }
|
|
|
+
|
|
|
synchronized(Configuration.class) {
|
|
|
REGISTRY.put(this, null);
|
|
|
}
|
|
|
+ this.classLoader = other.classLoader;
|
|
|
+ this.loadDefaults = other.loadDefaults;
|
|
|
+ setQuietMode(other.getQuietMode());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1025,28 +1025,26 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
getProps().setProperty(name, value);
|
|
|
String newSource = (source == null ? "programmatically" : source);
|
|
|
|
|
|
- synchronized (this) {
|
|
|
- if (!isDeprecated(name)) {
|
|
|
- updatingResource.put(name, new String[] {newSource});
|
|
|
- String[] altNames = getAlternativeNames(name);
|
|
|
- if(altNames != null) {
|
|
|
- for(String n: altNames) {
|
|
|
- if(!n.equals(name)) {
|
|
|
- getOverlay().setProperty(n, value);
|
|
|
- getProps().setProperty(n, value);
|
|
|
- updatingResource.put(n, new String[] {newSource});
|
|
|
- }
|
|
|
+ if (!isDeprecated(name)) {
|
|
|
+ updatingResource.put(name, new String[] {newSource});
|
|
|
+ String[] altNames = getAlternativeNames(name);
|
|
|
+ if(altNames != null) {
|
|
|
+ for(String n: altNames) {
|
|
|
+ if(!n.equals(name)) {
|
|
|
+ getOverlay().setProperty(n, value);
|
|
|
+ getProps().setProperty(n, value);
|
|
|
+ updatingResource.put(n, new String[] {newSource});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- String[] names = handleDeprecation(deprecationContext.get(), name);
|
|
|
- String altSource = "because " + name + " is deprecated";
|
|
|
- for(String n : names) {
|
|
|
- getOverlay().setProperty(n, value);
|
|
|
- getProps().setProperty(n, value);
|
|
|
- updatingResource.put(n, new String[] {altSource});
|
|
|
- }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ String[] names = handleDeprecation(deprecationContext.get(), name);
|
|
|
+ String altSource = "because " + name + " is deprecated";
|
|
|
+ for(String n : names) {
|
|
|
+ getOverlay().setProperty(n, value);
|
|
|
+ getProps().setProperty(n, value);
|
|
|
+ updatingResource.put(n, new String[] {altSource});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2279,7 +2277,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
*
|
|
|
* @return final parameter set.
|
|
|
*/
|
|
|
- public synchronized Set<String> getFinalParameters() {
|
|
|
+ public Set<String> getFinalParameters() {
|
|
|
return new HashSet<String>(finalParameters);
|
|
|
}
|
|
|
|
|
@@ -2542,18 +2540,14 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
if (value != null) {
|
|
|
if (!finalParameters.contains(attr)) {
|
|
|
properties.setProperty(attr, value);
|
|
|
- synchronized(this) {
|
|
|
- updatingResource.put(attr, source);
|
|
|
- }
|
|
|
+ updatingResource.put(attr, source);
|
|
|
} else if (!value.equals(properties.getProperty(attr))) {
|
|
|
LOG.warn(name+":an attempt to override final parameter: "+attr
|
|
|
+"; Ignoring.");
|
|
|
}
|
|
|
}
|
|
|
if (finalParameter) {
|
|
|
- synchronized(this) {
|
|
|
- finalParameters.add(attr);
|
|
|
- }
|
|
|
+ finalParameters.add(attr);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2747,7 +2741,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public synchronized void readFields(DataInput in) throws IOException {
|
|
|
+ public void readFields(DataInput in) throws IOException {
|
|
|
clear();
|
|
|
int size = WritableUtils.readVInt(in);
|
|
|
for(int i=0; i < size; ++i) {
|
|
@@ -2759,8 +2753,9 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //@Override
|
|
|
@Override
|
|
|
- public synchronized void write(DataOutput out) throws IOException {
|
|
|
+ public void write(DataOutput out) throws IOException {
|
|
|
Properties props = getProps();
|
|
|
WritableUtils.writeVInt(out, props.size());
|
|
|
for(Map.Entry<Object, Object> item: props.entrySet()) {
|