From e9081c0f17c53027ce87f925c0b78ea0a32cf94d Mon Sep 17 00:00:00 2001 From: reger Date: Wed, 1 Jan 2014 10:28:49 +0100 Subject: [PATCH] moved startup execAPIActions call after Jetty startup execAPIActions require http to be up. The 10s sleep was sufficient to allow Jetty to start, but it's more robust to place the call after http is assigned to switchboard/serverSwitch. --- source/net/yacy/search/Switchboard.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index ebe9111e5..32d07a6f7 100644 --- a/source/net/yacy/search/Switchboard.java +++ b/source/net/yacy/search/Switchboard.java @@ -208,6 +208,7 @@ import net.yacy.utils.UPnP; import net.yacy.utils.crypt; import com.google.common.io.Files; +import net.yacy.http.YaCyHttpServer; public final class Switchboard extends serverSwitch { @@ -1127,18 +1128,23 @@ public final class Switchboard extends serverSwitch { //plasmaSnippetCache.result scr = snippetCache.retrieve(new URL("http://www.heise.de/kiosk/archiv/ct/2003/4/20"), query, true, 260); this.trail = new LinkedBlockingQueue(); + + this.log.config("Finished Switchboard Initialization"); + } + + @Override + public void setHttpServer(YaCyHttpServer server) { + super.setHttpServer(server); // finally start jobs which shall be started after start-up new Thread() { public void run() { - try {Thread.sleep(10000);} catch (final InterruptedException e) {} // we must wait until the httpd comes up + try {Thread.sleep(10000);} catch (final InterruptedException e) {} // needs httpd up execAPIActions(); // trigger startup actions } - }.start(); - - this.log.config("Finished Switchboard Initialization"); + }.start(); } - + public int getIndexingProcessorsQueueSize() { return this.indexingDocumentProcessor.getQueueSize() + this.indexingCondensementProcessor.getQueueSize()