Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
refactoring of reindexSolr (just replaced constant string)
Michael Peter Christen5a060c9f26c7
diff --git a/htroot/IndexReIndexMonitor_p.java b/htroot/IndexReIndexMonitor_p.javaindex 1c4da9fec..e5689fc20 100644--- a/htroot/IndexReIndexMonitor_p.java+++ b/htroot/IndexReIndexMonitor_p.java@@ -36,14 +36,14 @@ public class IndexReIndexMonitor_p {prop.put("docsprocessed", "0");prop.put("currentselectquery","");- BusyThread bt = sb.getThread("reindexSolr");+ BusyThread bt = sb.getThread(ReindexSolrBusyThread.THREAD_NAME);if (bt == null) {if (post != null && post.containsKey("reindexnow") && sb.index.fulltext().connectedLocalSolr()) {migration.reindexToschema(sb);prop.put("querysize", "0");prop.put("infomessage","reindex job started");- bt = sb.getThread("reindexSolr"); //get new created job for following posts+ bt = sb.getThread(ReindexSolrBusyThread.THREAD_NAME); //get new created job for following posts}}@@ -70,7 +70,7 @@ public class IndexReIndexMonitor_p {}if (post != null && post.containsKey("stopreindex")) {- sb.terminateThread("reindexSolr", false);+ sb.terminateThread(ReindexSolrBusyThread.THREAD_NAME, false);prop.put("infomessage", "reindex job stopped");prop.put("reindexjobrunning",0);} else {diff --git a/source/net/yacy/migration.java b/source/net/yacy/migration.javaindex 15ccb5593..869b22e6b 100644--- a/source/net/yacy/migration.java+++ b/source/net/yacy/migration.java@@ -293,7 +293,7 @@ public class migration {*/public static int reindexToschema (final Switchboard sb) {- BusyThread bt = sb.getThread("reindexSolr");+ BusyThread bt = sb.getThread(ReindexSolrBusyThread.THREAD_NAME);// a reindex job is already runningif (bt != null) {return bt.getJobCount();@@ -363,7 +363,7 @@ public class migration {reidx.addSelectFieldname("outboundlinks_text_words_val");reidx.addSelectFieldname("outboundlinks_alttag_txt");}- sb.deployThread("reindexSolr", "Reindex Solr", "reindex documents with obsolete fields in embedded Solr index", "/IndexReIndexMonitor_p.html",reidx , 0);+ sb.deployThread(ReindexSolrBusyThread.THREAD_NAME, "Reindex Solr", "reindex documents with obsolete fields in embedded Solr index", "/IndexReIndexMonitor_p.html",reidx , 0);return 0;}}diff --git a/source/net/yacy/search/index/ReindexSolrBusyThread.java b/source/net/yacy/search/index/ReindexSolrBusyThread.javaindex b6aaa05d5..c38cd09ad 100644--- a/source/net/yacy/search/index/ReindexSolrBusyThread.java+++ b/source/net/yacy/search/index/ReindexSolrBusyThread.java@@ -53,6 +53,8 @@ import org.apache.solr.common.SolrInputDocument;*/public class ReindexSolrBusyThread extends AbstractBusyThread {+ public final static String THREAD_NAME = "reindexSolr";+SolrConnector esc;final CollectionConfiguration colcfg; // collection configint processed = 0; // total number of reindexed documents@@ -71,14 +73,14 @@ import org.apache.solr.common.SolrInputDocument;this.esc = Switchboard.getSwitchboard().index.fulltext().getDefaultConnector();this.colcfg = Switchboard.getSwitchboard().index.fulltext().getDefaultConfiguration();- if (Switchboard.getSwitchboard().getThread("reindexSolr") != null) {+ if (Switchboard.getSwitchboard().getThread(ReindexSolrBusyThread.THREAD_NAME) != null) {this.interrupt(); // only one active reindex job should exist} else {if (query != null) {this.querylist.set(query, 0);}}- setName("reindexSolr");+ setName(ReindexSolrBusyThread.THREAD_NAME);this.setPriority(Thread.MIN_PRIORITY);}@@ -154,7 +156,7 @@ import org.apache.solr.common.SolrInputDocument;}if (querylist.isEmpty()) { // if all processed remove from scheduled list (and terminate thread)- Switchboard.getSwitchboard().terminateThread("reindexSolr", false);+ Switchboard.getSwitchboard().terminateThread(ReindexSolrBusyThread.THREAD_NAME, false);ret = false;}return ret;diff --git a/source/net/yacy/server/serverSwitch.java b/source/net/yacy/server/serverSwitch.javaindex 5238cb7a3..2603fdc6f 100644--- a/source/net/yacy/server/serverSwitch.java+++ b/source/net/yacy/server/serverSwitch.java@@ -468,9 +468,9 @@ public class serverSwitch {threadMonitorURL,newThread,startupDelay,- Long.parseLong(getConfig(threadName + "_idlesleep", "100")),- Long.parseLong(getConfig(threadName + "_busysleep", "1000")),- Long.parseLong(getConfig(threadName + "_memprereq", "1000000")),+ Long.parseLong(getConfig(threadName + "_idlesleep", "1000")),+ Long.parseLong(getConfig(threadName + "_busysleep", "100")),+ Long.parseLong(getConfig(threadName + "_memprereq", "1048576")),Double.parseDouble(getConfig(threadName + "_loadprereq", "9.0")));}