Skip to content
Permalink
Browse files

Removed unnecessary synchronization lock from serverSwitch constructor

Lock was useless here as it was set on an object instance attribute
while the object itself is not yet constructed and no other threads can
access it.
  • Loading branch information...
luccioman committed Jul 16, 2018
1 parent dcee2ee commit d5f44ea2169ed3c214c30aef6eeb5aef07d9eba6
Showing with 15 additions and 17 deletions.
  1. +15 −17 source/net/yacy/server/serverSwitch.java
@@ -113,26 +113,24 @@ public serverSwitch(final File dataPath, final File appPath,

// remove all values from config that do not appear in init
this.configRemoved = new ConcurrentHashMap<String, String>();
synchronized (this.configProps) {
Iterator<String> i = this.configProps.keySet().iterator();
String key;
while (i.hasNext()) {
key = i.next();
if (!(initProps.containsKey(key))) {
this.configRemoved.put(key, this.configProps.get(key));
i.remove();
}
Iterator<String> i = this.configProps.keySet().iterator();
String key;
while (i.hasNext()) {
key = i.next();
if (!(initProps.containsKey(key))) {
this.configRemoved.put(key, this.configProps.get(key));
i.remove();
}
}

// merge new props from init to config
// this is necessary for migration, when new properties are attached
initProps.putAll(this.configProps);
this.configProps = initProps;
// merge new props from init to config
// this is necessary for migration, when new properties are attached
initProps.putAll(this.configProps);
this.configProps = initProps;

// save result; this may initially create a config file after
// initialization
saveConfig();
}
// save result; this may initially create a config file after
// initialization
saveConfig();

// init thread control
this.workerThreads = new TreeMap<String, BusyThread>();

0 comments on commit d5f44ea

Please sign in to comment.
You can’t perform that action at this time.