diff --git a/source/de/anomic/server/serverSwitch.java b/source/de/anomic/server/serverSwitch.java index 864fbc489..8adf78ce2 100644 --- a/source/de/anomic/server/serverSwitch.java +++ b/source/de/anomic/server/serverSwitch.java @@ -165,18 +165,18 @@ public class serverSwitch (int) getConfigLong("server.maxTrackingHostCount", 100)); } + /** + * get my public IP, either set statically or figure out dynamic + * @return + */ public String myPublicIP() { // if a static IP was configured, we have to return it here ... final String staticIP = getConfig("staticIP", ""); - if ( staticIP.length() > 0 ) { - return staticIP; - } + if ( !"".equals(staticIP) ) return staticIP; // otherwise we return the real IP address of this host final InetAddress pLIP = Domains.myPublicLocalIP(); - if ( pLIP != null ) { - return pLIP.getHostAddress(); - } + if ( pLIP != null ) return pLIP.getHostAddress(); return null; } @@ -189,6 +189,10 @@ public class serverSwitch return this.log; } + /** + * add whole map of key-value pairs to config + * @param otherConfigs + */ public void setConfig(final Map otherConfigs) { final Iterator> i = otherConfigs.entrySet().iterator(); Map.Entry entry; @@ -326,6 +330,9 @@ public class serverSwitch return this.configProps.keySet().iterator(); } + /** + * write the changes to permanent storage (File) + */ private void saveConfig() { ConcurrentMap configPropsCopy = new ConcurrentHashMap(); configPropsCopy.putAll(this.configProps); // avoid concurrency problems