Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fix for bug in new profile handling - added a new feature in ymageChart (cannot be seen yet, just wait... will be used in profiling chart)
orbiter2d65887723c6
diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.javaindex 660a9c493..0f49ecd24 100644--- a/source/de/anomic/crawler/CrawlQueues.java+++ b/source/de/anomic/crawler/CrawlQueues.java@@ -215,6 +215,7 @@ public class CrawlQueues {final String stats = "LOCALCRAWL[" + noticeURL.stackSize(NoticedURL.STACK_TYPE_CORE) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_OVERHANG) + ", " + noticeURL.stackSize(NoticedURL.STACK_TYPE_REMOTE) + "]";try {urlEntry = noticeURL.pop(NoticedURL.STACK_TYPE_CORE, true, sb.webIndex.profilesActiveCrawls);+ if (urlEntry == null) continue;final String profileHandle = urlEntry.profileHandle();// System.out.println("DEBUG plasmaSwitchboard.processCrawling:// profileHandle = " + profileHandle + ", urlEntry.url = " + urlEntry.url());diff --git a/source/de/anomic/crawler/NoticedURL.java b/source/de/anomic/crawler/NoticedURL.javaindex 637d63a69..e83497c18 100755--- a/source/de/anomic/crawler/NoticedURL.java+++ b/source/de/anomic/crawler/NoticedURL.java@@ -216,18 +216,18 @@ public class NoticedURL {int s;CrawlEntry entry;synchronized (balancer) {- while ((s = balancer.size()) > 0) {- entry = balancer.pop(delay, profile);- if (entry == null) {- if (s > balancer.size()) continue;- final int aftersize = balancer.size();- balancer.clear(); // the balancer is broken and cannot shrink- throw new IOException("entry is null, balancer cannot shrink (bevore pop = " + s + ", after pop = " + aftersize + "); reset of balancer");+ while ((s = balancer.size()) > 0) {+ entry = balancer.pop(delay, profile);+ if (entry == null) {+ if (s > balancer.size()) continue;+ final int aftersize = balancer.size();+ balancer.clear(); // the balancer is broken and cannot shrink+ throw new IOException("entry is null, balancer cannot shrink (bevore pop = " + s + ", after pop = " + aftersize + "); reset of balancer");+ }+ return entry;}- return entry;}- }- throw new IOException("balancer stack is empty");+ return null;}private ArrayList<CrawlEntry> top(final Balancer balancer, int count) {diff --git a/source/de/anomic/plasma/plasmaProfiling.java b/source/de/anomic/plasma/plasmaProfiling.javaindex 9ed2f8b9c..5f5b9d072 100644--- a/source/de/anomic/plasma/plasmaProfiling.java+++ b/source/de/anomic/plasma/plasmaProfiling.java@@ -72,17 +72,35 @@ public class plasmaProfiling {chart.declareDimension(ymageChart.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");chart.declareDimension(ymageChart.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "INDEXING, WORDS IN CACHE");chart.declareDimension(ymageChart.DIMENSION_RIGHT, rightscale, vspace * rightscale / (int)(maxbytes / 1024 / 1024), 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");- chart.declareDimension(ymageChart.DIMENSION_ANOT, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");+ chart.declareDimension(ymageChart.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");+ chart.declareDimension(ymageChart.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, "888800", null , "URL");// draw chartlong time;final long now = System.currentTimeMillis();long bytes;- int x0 = 1, x1, y0 = 0, y1, ppm, words;+ int x0, x1, y0, y1, ppm, words;serverProfiling.Event event;try {+ // draw urls+ /*+ Iterator<Event> i = serverProfiling.history("indexed");+ x0 = 1; y0 = 0;+ while (i.hasNext()) {+ event = i.next();+ time = event.time - now;+ x1 = (int) (time/1000);+ y1 = ppm;+ chart.setColor("AA8888");+ if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x0, y0, x1, y1);+ chart.setColor("AA2222");+ chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x1, y1, 2, ((String) event.payload), 315);+ x0 = x1; y0 = y1;+ }+ */// draw memoryIterator<Event> i = serverProfiling.history("memory");+ x0 = 1; y0 = 0;while (i.hasNext()) {event = i.next();time = event.time - now;@@ -90,7 +108,7 @@ public class plasmaProfiling {x1 = (int) (time/1000);y1 = (int) (bytes / 1024 / 1024);chart.setColor("AAAAFF");- chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x1, y1, 2, null);+ chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x1, y1, 2, null, 0);chart.setColor("0000FF");if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x0, y0, x1, y1);x0 = x1; y0 = y1;@@ -106,7 +124,7 @@ public class plasmaProfiling {x1 = (int) (time/1000);y1 = words;chart.setColor("228822");- chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x1, y1, 2, null);+ chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x1, y1, 2, null, 315);chart.setColor("008800");if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x0, y0, x1, y1);x0 = x1; y0 = y1;@@ -122,9 +140,9 @@ public class plasmaProfiling {x1 = (int) (time/1000);y1 = ppm;chart.setColor("AA8888");- if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT, x0, y0, x1, y1);+ if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x0, y0, x1, y1);chart.setColor("AA2222");- chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT, x1, y1, 2, ppm + " PPM");+ chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x1, y1, 2, ppm + " PPM", 0);x0 = x1; y0 = y1;}diff --git a/source/de/anomic/ymage/ymageChart.java b/source/de/anomic/ymage/ymageChart.javaindex 7df6e2091..1d8de3253 100644--- a/source/de/anomic/ymage/ymageChart.java+++ b/source/de/anomic/ymage/ymageChart.java@@ -33,18 +33,19 @@ public class ymageChart extends ymageMatrix {public static final int DIMENSION_TOP = 1;public static final int DIMENSION_LEFT = 2;public static final int DIMENSION_BOTTOM = 3;- public static final int DIMENSION_ANOT = 4;+ public static final int DIMENSION_ANOT0 = 4;+ public static final int DIMENSION_ANOT1 = 5;int leftborder;int rightborder;int topborder;int bottomborder;- int[] scales = new int[]{0,0,0,0,0};- int[] pixels = new int[]{0,0,0,0,0};- int[] offsets = new int[]{0,0,0,0,0};- String[] colnames = new String[]{"FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF"};- String[] colscale = new String[]{null,null,null,null,null};- String[] tablenames = new String[]{"","","","",""};+ int[] scales = new int[]{0,0,0,0,0,0};+ int[] pixels = new int[]{0,0,0,0,0,0};+ int[] offsets = new int[]{0,0,0,0,0,0};+ String[] colnames = new String[]{"FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF"};+ String[] colscale = new String[]{null,null,null,null,null,null};+ String[] tablenames = new String[]{"","","","","",""};//String name;//String backgroundColor, foregroundColor;@@ -84,12 +85,12 @@ public class ymageChart extends ymageMatrix {tablenames[dimensionType] = name;}- public void chartDot(final int dimension_x, final int dimension_y, final int coord_x, final int coord_y, final int dotsize, String anot) {+ public void chartDot(final int dimension_x, final int dimension_y, final int coord_x, final int coord_y, final int dotsize, String anot, int anotAngle) {final int x = (coord_x - offsets[dimension_x]) * pixels[dimension_x] / scales[dimension_x];final int y = (coord_y - offsets[dimension_y]) * pixels[dimension_y] / scales[dimension_y];if (dotsize == 1) plot(leftborder + x, height - bottomborder - y);else dot(leftborder + x, height - bottomborder - y, dotsize, true);- if (anot != null) ymageToolPrint.print(this, leftborder + x + dotsize + 2, height - bottomborder - y, 0, anot, -1);+ if (anot != null) ymageToolPrint.print(this, leftborder + x + dotsize + 2 + ((anotAngle == 315) ? -9 : 0), height - bottomborder - y + ((anotAngle == 315) ? -3 : 0), anotAngle, anot, (anotAngle == 0) ? -1 : ((anotAngle == 315) ? 1 : 0));}public void chartLine(final int dimension_x, final int dimension_y, final int coord_x1, final int coord_y1, final int coord_x2, final int coord_y2) {@@ -158,10 +159,10 @@ public class ymageChart extends ymageMatrix {ip.declareDimension(DIMENSION_LEFT, 50, 40, 0, green, scale , "PPM [PAGES/MINUTE]");ip.declareDimension(DIMENSION_RIGHT, 100, 20, 0, blue, scale, "MEMORY/MEGABYTE");ip.setColor(green);- ip.chartDot(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, 5, null);+ ip.chartDot(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, 5, null, 0);ip.chartLine(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, -130, 200);ip.setColor(blue);- ip.chartDot(DIMENSION_BOTTOM, DIMENSION_RIGHT, -50, 300, 2, null);+ ip.chartDot(DIMENSION_BOTTOM, DIMENSION_RIGHT, -50, 300, 2, null, 0);ip.chartLine(DIMENSION_BOTTOM, DIMENSION_RIGHT, -80, 100, -50, 300);//ip.print(100, 100, 0, "TEXT", true);//ip.print(100, 100, 0, "1234", false);diff --git a/source/de/anomic/ymage/ymageToolPrint.java b/source/de/anomic/ymage/ymageToolPrint.javaindex 2665258ef..f7614e205 100644--- a/source/de/anomic/ymage/ymageToolPrint.java+++ b/source/de/anomic/ymage/ymageToolPrint.java@@ -57,7 +57,7 @@ public class ymageToolPrint {for (int j = 0; j < 5; j++) {c = row & 3L;if (c == 3) matrix.plot(x + 5 - j, y, 100);- if (c == 2) matrix.plot(x + 5 - j, y, 35);+ if (c == 2) matrix.plot(x + 5 - j, y, 36);row = row >> 2;}y--;@@ -66,11 +66,21 @@ public class ymageToolPrint {for (int j = 0; j < 5; j++) {c = row & 3L;if (c == 3) matrix.plot(x, y - 5 + j, 100);- if (c == 2) matrix.plot(x, y - 5 + j, 35);+ if (c == 2) matrix.plot(x, y - 5 + j, 36);row = row >> 2;}x--;}+ if (angle == 315) {+ for (int j = 0; j < 5; j++) {+ c = row & 3L;+ if (c == 3) { matrix.plot(x + 5 - j, y + 5 - j, 100); matrix.plot(x + 6 - j, y + 5 - j, 50); matrix.plot(x + 5 - j, y + 6 - j, 50); }+ if (c == 2) { matrix.plot(x + 5 - j, y + 5 - j, 36); matrix.plot(x + 6 - j, y + 5 - j, 18); matrix.plot(x + 5 - j, y + 6 - j, 18); }+ row = row >> 2;+ }+ x++;+ y--;+ }}}@@ -85,11 +95,15 @@ public class ymageToolPrint {} else if (angle == 90) {xx = x;yy = (align == -1) ? y : (align == 1) ? y + 6 * message.length() : y + 3 * message.length();+ } else if (angle == 315) {+ xx = (align == -1) ? x : (align == 1) ? x - 6 * message.length() : x - 3 * message.length();+ yy = (align == -1) ? y : (align == 1) ? y - 6 * message.length() : y - 3 * message.length();}for (int i = 0; i < message.length(); i++) {print(matrix, xx, yy, angle, message.charAt(i));if (angle == 0) xx += 6;else if (angle == 90) yy -= 6;+ else if (angle == 315) {xx += 6; yy += 6;}}}