From 56e4dbeb71d535b1b28d7f75d853e52835def1bb Mon Sep 17 00:00:00 2001 From: theli Date: Sat, 28 Jan 2006 15:17:04 +0000 Subject: [PATCH] *) displaying current active + current idle threads in PerformanceQueues_p.html now git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1470 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/PerformanceQueues_p.html | 6 +++++- htroot/PerformanceQueues_p.java | 10 ++++++++-- source/de/anomic/plasma/plasmaCrawlLoader.java | 8 ++++++++ source/de/anomic/plasma/plasmaCrawlStacker.java | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/htroot/PerformanceQueues_p.html b/htroot/PerformanceQueues_p.html index 1c96db534..bffa4268d 100644 --- a/htroot/PerformanceQueues_p.html +++ b/htroot/PerformanceQueues_p.html @@ -118,6 +118,8 @@ Changes take effect immediately maximum Active maximum Idle minimum Idle +current Active +current Idle Full Description #{pool}# @@ -126,11 +128,13 @@ Changes take effect immediately +#[numActive]# +#[numIdle]# #{/pool}# - + Changes take effect immediately diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java index 04f9286af..cc3c2f445 100644 --- a/htroot/PerformanceQueues_p.java +++ b/htroot/PerformanceQueues_p.java @@ -279,19 +279,25 @@ public class PerformanceQueues_p { prop.put("pool_0_maxActive",crawlerPoolConfig.maxActive); prop.put("pool_0_maxIdle",crawlerPoolConfig.maxIdle); prop.put("pool_0_minIdle",crawlerPoolConfig.minIdle); + prop.put("pool_0_numActive",switchboard.cacheLoader.getNumActiveWorker()); + prop.put("pool_0_numIdle",switchboard.cacheLoader.getNumIdleWorker()); serverThread httpd = switchboard.getThread("10_httpd"); GenericObjectPool.Config httpdPoolConfig = ((serverCore)httpd).getPoolConfig(); prop.put("pool_1_name","httpd Session Pool"); prop.put("pool_1_maxActive",httpdPoolConfig.maxActive); prop.put("pool_1_maxIdle",httpdPoolConfig.maxIdle); - prop.put("pool_1_minIdle",httpdPoolConfig.minIdle); + prop.put("pool_1_minIdle",httpdPoolConfig.minIdle); + prop.put("pool_1_numActive",((serverCore)httpd).getActiveSessionCount()); + prop.put("pool_1_numIdle",((serverCore)httpd).getIdleSessionCount()); GenericObjectPool.Config stackerPoolConfig = switchboard.sbStackCrawlThread.getPoolConfig(); prop.put("pool_2_name","CrawlStacker Session Pool"); prop.put("pool_2_maxActive",stackerPoolConfig.maxActive); prop.put("pool_2_maxIdle",stackerPoolConfig.maxIdle); - prop.put("pool_2_minIdle",stackerPoolConfig.minIdle); + prop.put("pool_2_minIdle",stackerPoolConfig.minIdle); + prop.put("pool_2_numActive",switchboard.sbStackCrawlThread.getNumActiveWorker()); + prop.put("pool_2_numIdle",switchboard.sbStackCrawlThread.getNumIdleWorker()); prop.put("pool",3); // return rewrite values for templates diff --git a/source/de/anomic/plasma/plasmaCrawlLoader.java b/source/de/anomic/plasma/plasmaCrawlLoader.java index 4d199655c..4cdfc3bb2 100644 --- a/source/de/anomic/plasma/plasmaCrawlLoader.java +++ b/source/de/anomic/plasma/plasmaCrawlLoader.java @@ -200,6 +200,14 @@ public final class plasmaCrawlLoader extends Thread { } } + public int getNumIdleWorker() { + return crawlwerPool.getNumIdle(); + } + + public int getNumActiveWorker() { + return size(); + } + public int size() { return crawlwerPool.getNumActive(); } diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.java index 061e14f52..34bd23061 100644 --- a/source/de/anomic/plasma/plasmaCrawlStacker.java +++ b/source/de/anomic/plasma/plasmaCrawlStacker.java @@ -137,6 +137,14 @@ public final class plasmaCrawlStacker { } } + public int getNumActiveWorker() { + return this.theWorkerPool.getNumActive(); + } + + public int getNumIdleWorker() { + return this.theWorkerPool.getNumIdle(); + } + public int size() { return this.queue.size(); } @@ -636,7 +644,9 @@ public final class plasmaCrawlStacker { public void destroyObject(Object obj) { if (obj instanceof Worker) { Worker theWorker = (Worker) obj; + ((Worker)obj).setName("stackCrawlThread_destroyed"); theWorker.setStopped(true); + theWorker.interrupt(); } } @@ -719,6 +729,7 @@ public final class plasmaCrawlStacker { if (this.isClosed) return; if (obj instanceof Worker) { try { + ((Worker)obj).setName("stackCrawlThread_invalidated"); ((Worker)obj).setStopped(true); super.invalidateObject(obj); } catch (Exception e) { @@ -834,6 +845,7 @@ public final class plasmaCrawlStacker { } public void run() { + boolean interrupted = false; this.running = true; try { @@ -856,9 +868,10 @@ public final class plasmaCrawlStacker { } } } catch (InterruptedException ex) { + interrupted = true; serverLog.logInfo("STACKCRAWL-POOL","Interruption of thread '" + this.getName() + "' detected."); } finally { - if (plasmaCrawlStacker.this.theWorkerPool != null) + if (plasmaCrawlStacker.this.theWorkerPool != null && !interrupted) plasmaCrawlStacker.this.theWorkerPool.invalidateObject(this); } }