diff --git a/htroot/IndexCreate_p.java b/htroot/IndexCreate_p.java index a5e5315ea..48293d705 100644 --- a/htroot/IndexCreate_p.java +++ b/htroot/IndexCreate_p.java @@ -281,12 +281,12 @@ public class IndexCreate_p { if (post.containsKey("pausecrawlqueue")) { - switchboard.pauseCrawling(); + switchboard.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); prop.put("info", 4);//crawling paused } if (post.containsKey("continuecrawlqueue")) { - switchboard.continueCrawling(); + switchboard.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); prop.put("info", 5);//crawling continued } } @@ -454,7 +454,7 @@ public class IndexCreate_p { } - prop.put("crawler-paused",(switchboard.crawlingIsPaused())?0:1); + prop.put("crawler-paused",(switchboard.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL))?0:1); // return rewrite properties return prop; diff --git a/htroot/ScreenSaver.java b/htroot/ScreenSaver.java index 2c565dcfc..23da0d560 100644 --- a/htroot/ScreenSaver.java +++ b/htroot/ScreenSaver.java @@ -74,7 +74,9 @@ public class ScreenSaver { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { plasmaSwitchboard sb = (plasmaSwitchboard)env; - boolean crawlingStarted = false; + boolean localCrawlStarted = false; + boolean remoteTriggeredCrawlStarted = false; + boolean globalCrawlTriggerStarted = false; try { InputStream input = (InputStream) header.get("INPUTSTREAM"); OutputStream output = (OutputStream) header.get("OUTPUTSTREAM"); @@ -110,10 +112,18 @@ public class ScreenSaver { outputWriter.println(currentURL); } else if (line.equals("CONTINUECRAWLING")) { - if (sb.crawlingIsPaused()) { - crawlingStarted = true; - sb.continueCrawling(); + if (sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL)) { + localCrawlStarted = true; + sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); } + if (sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)) { + remoteTriggeredCrawlStarted = true; + sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); + } + if (sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER)) { + globalCrawlTriggerStarted = true; + sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER); + } } else if (line.equals("EXIT")) { outputWriter.println("OK"); outputWriter.flush(); @@ -128,9 +138,15 @@ public class ScreenSaver { } catch (Exception e) { return null; } finally { - if (crawlingStarted) { - sb.pauseCrawling(); + if (localCrawlStarted) { + sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); } + if (remoteTriggeredCrawlStarted) { + sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); + } + if (globalCrawlTriggerStarted) { + sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER); + } } } diff --git a/htroot/Status.java b/htroot/Status.java index 4e8366c48..ce1b84f50 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -78,10 +78,22 @@ public class Status { prop.put("LOCATION",""); } } else { - if (post.containsKey("pausecrawlqueue")) { - ((plasmaSwitchboard)env).pauseCrawling(); - } else if (post.containsKey("continuecrawlqueue")) { - ((plasmaSwitchboard)env).continueCrawling(); + if (post.containsKey("pauseCrawlJob")) { + String jobType = (String) post.get("jobType"); + if (jobType.equals("localCrawl")) + ((plasmaSwitchboard)env).pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); + else if (jobType.equals("remoteTriggeredCrawl")) + ((plasmaSwitchboard)env).pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); + else if (jobType.equals("globalCrawlTrigger")) + ((plasmaSwitchboard)env).pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER); + } else if (post.containsKey("continueCrawlJob")) { + String jobType = (String) post.get("jobType"); + if (jobType.equals("localCrawl")) + ((plasmaSwitchboard)env).continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); + else if (jobType.equals("remoteTriggeredCrawl")) + ((plasmaSwitchboard)env).continueCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); + else if (jobType.equals("globalCrawlTrigger")) + ((plasmaSwitchboard)env).continueCrawlJob(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER); } else if (post.containsKey("ResetTraffic")) { httpdByteCountInputStream.resetCount(); httpdByteCountOutputStream.resetCount(); @@ -278,13 +290,18 @@ public class Status { prop.put("indexingQueueMax", Integer.toString(plasmaSwitchboard.indexingSlots)); prop.put("loaderQueueSize", Integer.toString(sb.cacheLoader.size())); - prop.put("loaderQueueMax", Integer.toString(plasmaSwitchboard.crawlSlots)); - prop.put("loaderPaused",sb.crawlingIsPaused()?1:0); + prop.put("loaderQueueMax", Integer.toString(plasmaSwitchboard.crawlSlots)); - prop.put("localCrawlQueueSize", Integer.toString(sb.getThread("50_localcrawl").getJobCount())); + prop.put("localCrawlQueueSize", Integer.toString(sb.getThread(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL).getJobCount())); + prop.put("localCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL)?1:0); + + prop.put("remoteTriggeredCrawlQueueSize", Integer.toString(sb.getThread(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL).getJobCount())); + prop.put("remoteTriggeredCrawlPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL)?1:0); + + prop.put("globalCrawlTriggerQueueSize", Integer.toString(sb.getThread(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER).getJobCount())); + prop.put("globalCrawlTriggerPaused",sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_GLOBAL_CRAWL_TRIGGER)?1:0); + prop.put("stackCrawlQueueSize", Integer.toString(sb.sbStackCrawlThread.size())); - prop.put("remoteCrawlQueueSize", Integer.toString(sb.getThread("62_remotetriggeredcrawl").getJobCount())); - prop.put("remoteCrawlTriggerQueueSize", Integer.toString(sb.getThread("61_globalcrawltrigger").getJobCount())); // return rewrite properties prop.put("date",(new Date()).toString()); diff --git a/htroot/Status_p.inc b/htroot/Status_p.inc index 19e60cc03..436c8d193 100644 --- a/htroot/Status_p.inc +++ b/htroot/Status_p.inc @@ -1,4 +1,4 @@ -
Private System Properties | |||||
Loader Queue | -#[loaderQueueSize]# | #[loaderQueueMax]# #(loaderPaused)#::(paused)#(/loaderPaused)# | +#[loaderQueueSize]# | #[loaderQueueMax]# | [Details] | ||
Crawler Queue | -Enqueued from: local=#[localCrawlQueueSize]# remote=#[remoteCrawlQueueSize]# | Pending: #[stackCrawlQueueSize]# | -[Details] | -|||
Remote Crawl Trigger Queue | -#[remoteCrawlTriggerQueueSize]# | -[Details] | +Crawler Queues | ++ | +[Details] + + [Details] + |
true
if crawling was paused or false
otherwise
*/
- public boolean crawlingIsPaused() {
- synchronized(this.crawlingPausedSync) {
- return this.crawlingIsPaused;
+ public boolean crawlJobIsPaused(String jobType) {
+ Object[] status = (Object[])this.crawlJobsStatus.get(jobType);
+ synchronized(status[CRAWLJOB_SYNC]) {
+ return ((Boolean)status[CRAWLJOB_STATUS]).booleanValue();
}
}
@@ -1012,10 +1039,11 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
//if (!(cacheManager.idle())) try {Thread.currentThread().sleep(2000);} catch (InterruptedException e) {}
// if crawling was paused we have to wait until we wer notified to continue
- synchronized(this.crawlingPausedSync) {
- if (this.crawlingIsPaused) {
+ Object[] status = (Object[])this.crawlJobsStatus.get(CRAWLJOB_LOCAL_CRAWL);
+ synchronized(status[CRAWLJOB_SYNC]) {
+ if (((Boolean)status[CRAWLJOB_STATUS]).booleanValue()) {
try {
- this.crawlingPausedSync.wait();
+ status[CRAWLJOB_SYNC].wait();
}
catch (InterruptedException e){ return false;}
}
@@ -1090,10 +1118,11 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
//if (!(cacheManager.idle())) try {Thread.currentThread().sleep(2000);} catch (InterruptedException e) {}
// if crawling was paused we have to wait until we wer notified to continue
- synchronized(this.crawlingPausedSync) {
- if (this.crawlingIsPaused) {
+ Object[] status = (Object[])this.crawlJobsStatus.get(CRAWLJOB_GLOBAL_CRAWL_TRIGGER);
+ synchronized(status[CRAWLJOB_SYNC]) {
+ if (((Boolean)status[CRAWLJOB_STATUS]).booleanValue()) {
try {
- this.crawlingPausedSync.wait();
+ status[CRAWLJOB_SYNC].wait();
}
catch (InterruptedException e){ return false;}
}
@@ -1152,12 +1181,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
// if crawling was paused we have to wait until we wer notified to continue
- synchronized(this.crawlingPausedSync) {
- if (this.crawlingIsPaused) {
+ Object[] status = (Object[])this.crawlJobsStatus.get(CRAWLJOB_REMOTE_TRIGGERED_CRAWL);
+ synchronized(status[CRAWLJOB_SYNC]) {
+ if (((Boolean)status[CRAWLJOB_STATUS]).booleanValue()) {
try {
- this.crawlingPausedSync.wait();
+ status[CRAWLJOB_SYNC].wait();
}
- catch (InterruptedException e){ return false; }
+ catch (InterruptedException e){ return false;}
}
}
diff --git a/yacy.init b/yacy.init
index 34f4bae80..7e0b8de69 100644
--- a/yacy.init
+++ b/yacy.init
@@ -429,12 +429,15 @@ xpstopw=true
50_localcrawl_idlesleep=10000
50_localcrawl_busysleep=200
50_localcrawl_memprereq=1048576
+50_localcrawl_isPaused=false
61_globalcrawltrigger_idlesleep=10000
61_globalcrawltrigger_busysleep=200
61_globalcrawltrigger_memprereq=1048576
+61_globalcrawltrigger_isPaused=false
62_remotetriggeredcrawl_idlesleep=10000
62_remotetriggeredcrawl_busysleep=200
62_remotetriggeredcrawl_memprereq=1048576
+62_remotetriggeredcrawl_isPaused=false
70_cachemanager_idlesleep=5000
70_cachemanager_busysleep=0
70_cachemanager_memprereq=1048576
@@ -561,7 +564,6 @@ onlineCautionDelay=30000
crawler.acceptLanguage=en-us,en;q=0.5
crawler.acceptCharset=ISO-8859-1,utf-8;q=0.7,*;q=0.7
crawler.clientTimeout=9000
-crawler.isPaused=false
# maximum number of crawler threads
crawler.MaxActiveThreads = 10