Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Added some JavaDoc and moved crawlStacker close at the right place.

luccioman7d5ba2afa481
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 21eea8bb4..3ff8c747b 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -1298,6 +1298,12 @@ public final class Switchboard extends serverSwitch {
ClientIdentification.generateYaCyBot(sysinfo);
}
+ /**
+ * Switch network configuration to the new specified one
+ * @param networkDefinition YaCy network definition file path (relative to the app path) or absolute URL
+ * @throws FileNotFoundException when the file was not found
+ * @throws IOException when an error occured
+ */
public void switchNetwork(final String networkDefinition) throws FileNotFoundException, IOException {
this.log.info("SWITCH NETWORK: switching to '" + networkDefinition + "'");
// pause crawls
@@ -1327,11 +1333,13 @@ public final class Switchboard extends serverSwitch {
if ( this.dhtDispatcher != null ) {
this.dhtDispatcher.close();
}
+ /* Crawlstacker is eventually triggering write operations on this.index : we must therefore close it before closing this.index */
+ this.crawlStacker.announceClose();
+ this.crawlStacker.close();
+
synchronized ( this.index ) {
this.index.close();
}
- this.crawlStacker.announceClose();
- this.crawlStacker.close();
this.webStructure.close();
this.log.info("SWITCH NETWORK: START UP OF NEW INDEX DATABASE...");