added support for multiple (fail-over) network definition locations when http-locations are given. multiple locations can be given with a comma-separated list of urls pointing to the network definition file

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6780 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent f83b1b91b9
commit a85c5bb8a7

@ -715,9 +715,18 @@ public final class Switchboard extends serverSwitch {
// or independently using a bootstrap URL
Map<String, String> initProps;
if (networkUnitDefinition.startsWith("http://")) {
try {
setConfig(Switchboard.loadHashMap(new DigestURI(networkUnitDefinition, null)));
} catch (final MalformedURLException e) { }
// multiple definitions may be given, split the definition line in multiple addresses
String[] netdefs = networkUnitDefinition.split(",");
Map<String, String> netdefmap;
netload: for (String netdef: netdefs) {
netdef = netdef.trim();
try {
netdefmap = Switchboard.loadHashMap(new DigestURI(netdef, null));
if (netdefmap == null || netdefmap.size() == 0) continue netload;
setConfig(netdefmap);
break netload;
} catch (final MalformedURLException e) {}
}
} else {
final File networkUnitDefinitionFile = (networkUnitDefinition.length() > 0 && networkUnitDefinition.charAt(0) == '/') ? new File(networkUnitDefinition) : new File(getRootPath(), networkUnitDefinition);
if (networkUnitDefinitionFile.exists()) {
@ -2229,6 +2238,7 @@ public final class Switchboard extends serverSwitch {
if (result == null) return new HashMap<String, String>();
return result;
} catch (final Exception e) {
Log.logException(e);
return new HashMap<String, String>();
}
}

Loading…
Cancel
Save