From 53d9ab6db744fb905e83c72057e35561950a0682 Mon Sep 17 00:00:00 2001 From: auron_x Date: Sun, 14 May 2006 08:42:41 +0000 Subject: [PATCH] *)fixed bug in PerformanceMemory_p.java which caused negative memory-values on big peers see http://www.yacy-forum.de/viewtopic.php?t=2370 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2091 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/PerformanceMemory_p.java | 4 ++-- source/de/anomic/data/blogBoard.java | 11 +++++----- source/de/anomic/data/messageBoard.java | 4 ++-- source/de/anomic/data/userDB.java | 4 ++-- source/de/anomic/data/wikiBoard.java | 16 +++++++-------- source/de/anomic/kelondro/kelondroMap.java | 4 ++-- .../de/anomic/kelondro/kelondroRecords.java | 10 +++++----- .../de/anomic/plasma/plasmaCrawlProfile.java | 4 ++-- .../anomic/plasma/plasmaCrawlRobotsTxt.java | 4 ++-- source/de/anomic/plasma/plasmaHTCache.java | 4 ++-- source/de/anomic/plasma/plasmaWordIndex.java | 4 ++-- .../plasma/plasmaWordIndexAssortment.java | 4 ++-- .../plasmaWordIndexAssortmentCluster.java | 8 ++++---- source/de/anomic/yacy/yacyNewsDB.java | 4 ++-- source/de/anomic/yacy/yacyNewsPool.java | 4 ++-- source/de/anomic/yacy/yacySeedDB.java | 20 +++++++++---------- 16 files changed, 55 insertions(+), 54 deletions(-) diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.java index 8d2e0af5b..52e841a73 100644 --- a/htroot/PerformanceMemory_p.java +++ b/htroot/PerformanceMemory_p.java @@ -63,9 +63,9 @@ public class PerformanceMemory_p { private static final int MB = 1024 * KB; private static Map defaultSettings = null; - private static int[] slt,chk; + private static long[] slt,chk; private static String[] ost; - private static int req, usd, bst, god; + private static long req, usd, bst, god; private static long usedTotal, currTotal, dfltTotal, goodTotal, bestTotal; diff --git a/source/de/anomic/data/blogBoard.java b/source/de/anomic/data/blogBoard.java index f35cbffb3..f3db22035 100644 --- a/source/de/anomic/data/blogBoard.java +++ b/source/de/anomic/data/blogBoard.java @@ -38,7 +38,8 @@ // the intact and unchanged copyright notice. // Contributions and changes to the program code must be marked as such. -// Contains contributions from Jan Sandbrink [JS] +// This file is contributed by Jan Sandbrink +// based on the Code of wikiBoard.java package de.anomic.data; @@ -85,11 +86,11 @@ public class blogBoard { return datbase.size(); } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return datbase.cacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return datbase.cacheNodeFillStatus(); } @@ -139,9 +140,9 @@ public class blogBoard { if(date == null) date = new GregorianCalendar(GMTTimeZone).getTime(); record.put("date", dateString(date)); if ((subject == null) || (subject.length() == 0)) subject = ""; - record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject.getBytes())); + record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject.getBytes("UTF-8"))); if ((author == null) || (author.length() == 0)) author = "anonymous"; - record.put("author", kelondroBase64Order.enhancedCoder.encode(author.getBytes())); + record.put("author", kelondroBase64Order.enhancedCoder.encode(author.getBytes("UTF-8"))); if ((ip == null) || (ip.length() == 0)) ip = ""; record.put("ip", ip); if (page == null) diff --git a/source/de/anomic/data/messageBoard.java b/source/de/anomic/data/messageBoard.java index 81bf0feb8..1fda6e64f 100644 --- a/source/de/anomic/data/messageBoard.java +++ b/source/de/anomic/data/messageBoard.java @@ -86,11 +86,11 @@ public class messageBoard { return database.size(); } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return database.cacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return database.cacheNodeFillStatus(); } diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.java index e2c8caa6c..535f77ffb 100644 --- a/source/de/anomic/data/userDB.java +++ b/source/de/anomic/data/userDB.java @@ -91,11 +91,11 @@ public final class userDB { } } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return userTable.cacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return userTable.cacheNodeFillStatus(); } diff --git a/source/de/anomic/data/wikiBoard.java b/source/de/anomic/data/wikiBoard.java index cae4ce3b4..a93429b2f 100644 --- a/source/de/anomic/data/wikiBoard.java +++ b/source/de/anomic/data/wikiBoard.java @@ -100,20 +100,20 @@ public class wikiBoard { return datbase.size(); } - public int[] dbCacheNodeChunkSize() { - int[] db = datbase.cacheNodeChunkSize(); - int[] bk = bkpbase.cacheNodeChunkSize(); - int[] i = new int[3]; + public long[] dbCacheNodeChunkSize() { + long[] db = datbase.cacheNodeChunkSize(); + long[] bk = bkpbase.cacheNodeChunkSize(); + long[] i = new long[3]; i[kelondroRecords.CP_LOW] = (db[kelondroRecords.CP_LOW] + bk[kelondroRecords.CP_LOW]) / 2; i[kelondroRecords.CP_MEDIUM] = (db[kelondroRecords.CP_MEDIUM] + bk[kelondroRecords.CP_MEDIUM]) / 2; i[kelondroRecords.CP_HIGH] = (db[kelondroRecords.CP_HIGH] + bk[kelondroRecords.CP_HIGH]) / 2; return i; } - public int[] dbCacheNodeFillStatus() { - int[] a = datbase.cacheNodeFillStatus(); - int[] b = bkpbase.cacheNodeFillStatus(); - return new int[]{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]}; + public long[] dbCacheNodeFillStatus() { + long[] a = datbase.cacheNodeFillStatus(); + long[] b = bkpbase.cacheNodeFillStatus(); + return new long[]{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]}; } public String[] dbCacheObjectStatus() { diff --git a/source/de/anomic/kelondro/kelondroMap.java b/source/de/anomic/kelondro/kelondroMap.java index 38b508daf..a3e8cb05b 100644 --- a/source/de/anomic/kelondro/kelondroMap.java +++ b/source/de/anomic/kelondro/kelondroMap.java @@ -133,11 +133,11 @@ public class kelondroMap { return dyn.columnSize(0); } - public int[] cacheNodeChunkSize() { + public long[] cacheNodeChunkSize() { return dyn.cacheNodeChunkSize(); } - public int[] cacheNodeFillStatus() { + public long[] cacheNodeFillStatus() { return dyn.cacheNodeFillStatus(); } diff --git a/source/de/anomic/kelondro/kelondroRecords.java b/source/de/anomic/kelondro/kelondroRecords.java index 2adec2b78..015702324 100644 --- a/source/de/anomic/kelondro/kelondroRecords.java +++ b/source/de/anomic/kelondro/kelondroRecords.java @@ -456,21 +456,21 @@ public class kelondroRecords { return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0); } - public int[] cacheNodeChunkSize() { + public long[] cacheNodeChunkSize() { // returns three integers: // #0: chunk size of CP_LOW - priority entries // #1: chunk size of CP_MEDIUM - priority entries // #2: chunk size of CP_HIGH - priority entries - int[] i = new int[3]; + long[] i = new long[3]; i[CP_LOW] = cacheNodeChunkSize(false); i[CP_MEDIUM] = cacheNodeChunkSize(false); i[CP_HIGH] = cacheNodeChunkSize(this.cacheScore != null); return i; } - public int[] cacheNodeFillStatus() { - if (XcacheHeaders == null) return new int[]{0,0,0,0}; - return new int[]{XcacheSize - (XcacheHeaders[CP_HIGH].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_LOW].size()), XcacheHeaders[CP_HIGH].size(), XcacheHeaders[CP_MEDIUM].size(), XcacheHeaders[CP_LOW].size()}; + public long[] cacheNodeFillStatus() { + if (XcacheHeaders == null) return new long[]{0,0,0,0}; + return new long[]{XcacheSize - (XcacheHeaders[CP_HIGH].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_LOW].size()), XcacheHeaders[CP_HIGH].size(), XcacheHeaders[CP_MEDIUM].size(), XcacheHeaders[CP_LOW].size()}; } protected Node newNode() throws IOException { diff --git a/source/de/anomic/plasma/plasmaCrawlProfile.java b/source/de/anomic/plasma/plasmaCrawlProfile.java index 4b226375f..79a5b233a 100644 --- a/source/de/anomic/plasma/plasmaCrawlProfile.java +++ b/source/de/anomic/plasma/plasmaCrawlProfile.java @@ -77,11 +77,11 @@ public class plasmaCrawlProfile { domsCache = new HashMap(); } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return profileTable.cacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return profileTable.cacheNodeFillStatus(); } diff --git a/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java b/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java index 7d5c4bd90..a072f13c4 100644 --- a/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java +++ b/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java @@ -85,11 +85,11 @@ public class plasmaCrawlRobotsTxt { } } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return robotsTable.cacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return robotsTable.cacheNodeFillStatus(); } diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index 4ad24dabb..3103f23f2 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -201,11 +201,11 @@ public final class plasmaHTCache { return this.responseHeaderDB.size(); } - public int[] dbCacheChunkSize() { + public long[] dbCacheChunkSize() { return this.responseHeaderDB.cacheNodeChunkSize(); } - public int[] dbCacheFillStatus() { + public long[] dbCacheFillStatus() { return this.responseHeaderDB.cacheNodeFillStatus(); } diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index 46d3af383..58d2f2222 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -125,11 +125,11 @@ public final class plasmaWordIndex { return assortmentCluster.sizes(); } - public int[] assortmentsCacheChunkSizeAvg() { + public long[] assortmentsCacheChunkSizeAvg() { return assortmentCluster.cacheChunkSizeAvg(); } - public int[] assortmentsCacheFillStatusCml() { + public long[] assortmentsCacheFillStatusCml() { return assortmentCluster.cacheFillStatusCml(); } diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortment.java b/source/de/anomic/plasma/plasmaWordIndexAssortment.java index 9dd8eb7d0..bf4cf1d7c 100644 --- a/source/de/anomic/plasma/plasmaWordIndexAssortment.java +++ b/source/de/anomic/plasma/plasmaWordIndexAssortment.java @@ -261,11 +261,11 @@ public final class plasmaWordIndexAssortment { return assortments.size(); } - public int[] cacheNodeChunkSize() { + public long[] cacheNodeChunkSize() { return assortments.cacheNodeChunkSize(); } - public int[] cacheNodeFillStatus() { + public long[] cacheNodeFillStatus() { return assortments.cacheNodeFillStatus(); } diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java b/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java index 73c98be6c..fd04dbe4e 100644 --- a/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java +++ b/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java @@ -263,9 +263,9 @@ public final class plasmaWordIndexAssortmentCluster { return sizes; } - public int[] cacheChunkSizeAvg() { + public long[] cacheChunkSizeAvg() { int[] i = new int[]{0, 0, 0}; - int[] a = new int[3]; + long[] a = new long[3]; for (int j = 0; j < clusterCount; j++) { a = assortments[j].cacheNodeChunkSize(); i[kelondroRecords.CP_LOW] += a[kelondroRecords.CP_LOW]; @@ -278,8 +278,8 @@ public final class plasmaWordIndexAssortmentCluster { return a; } - public int[] cacheFillStatusCml() { - int[] a, cml = new int[]{0, 0, 0, 0}; + public long[] cacheFillStatusCml() { + long[] a, cml = new long[]{0, 0, 0, 0}; for (int i = 0; i < clusterCount; i++) { a = assortments[i].cacheNodeFillStatus(); for (int j = 0; j < 4; j++) cml[j] += a[j]; diff --git a/source/de/anomic/yacy/yacyNewsDB.java b/source/de/anomic/yacy/yacyNewsDB.java index 86fe75786..6484296ad 100644 --- a/source/de/anomic/yacy/yacyNewsDB.java +++ b/source/de/anomic/yacy/yacyNewsDB.java @@ -96,11 +96,11 @@ public class yacyNewsDB { news = createDB(path, bufferkb); } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return news.cacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return news.cacheNodeFillStatus(); } diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java index bab1d2fa9..52c96dd0a 100644 --- a/source/de/anomic/yacy/yacyNewsPool.java +++ b/source/de/anomic/yacy/yacyNewsPool.java @@ -106,11 +106,11 @@ public class yacyNewsPool { return newsDB.size(); } - public int[] dbCacheNodeChunkSize() { + public long[] dbCacheNodeChunkSize() { return newsDB.dbCacheNodeChunkSize(); } - public int[] dbCacheNodeFillStatus() { + public long[] dbCacheNodeFillStatus() { return newsDB.dbCacheNodeFillStatus(); } diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java index 90731c04a..dd6588740 100644 --- a/source/de/anomic/yacy/yacySeedDB.java +++ b/source/de/anomic/yacy/yacySeedDB.java @@ -170,22 +170,22 @@ public final class yacySeedDB { } catch (IOException e) {} } - public int[] dbCacheNodeChunkSize() { - int[] ac = seedActiveDB.cacheNodeChunkSize(); - int[] pa = seedPassiveDB.cacheNodeChunkSize(); - int[] po = seedPotentialDB.cacheNodeChunkSize(); - int[] i = new int[3]; + public long[] dbCacheNodeChunkSize() { + long[] ac = seedActiveDB.cacheNodeChunkSize(); + long[] pa = seedPassiveDB.cacheNodeChunkSize(); + long[] po = seedPotentialDB.cacheNodeChunkSize(); + long[] i = new long[3]; i[kelondroRecords.CP_LOW] = (ac[kelondroRecords.CP_LOW] + pa[kelondroRecords.CP_LOW] + po[kelondroRecords.CP_LOW]) / 3; i[kelondroRecords.CP_MEDIUM] = (ac[kelondroRecords.CP_MEDIUM] + pa[kelondroRecords.CP_MEDIUM] + po[kelondroRecords.CP_MEDIUM]) / 3; i[kelondroRecords.CP_HIGH] = (ac[kelondroRecords.CP_HIGH] + pa[kelondroRecords.CP_HIGH] + po[kelondroRecords.CP_HIGH]) / 3; return i; } - public int[] dbCacheNodeFillStatus() { - int[] ac = seedActiveDB.cacheNodeFillStatus(); - int[] pa = seedPassiveDB.cacheNodeFillStatus(); - int[] po = seedPotentialDB.cacheNodeFillStatus(); - return new int[]{ac[0] + pa[0] + po[0], ac[1] + pa[1] + po[1], ac[2] + pa[2] + po[2], ac[3] + pa[3] + po[3]}; + public long[] dbCacheNodeFillStatus() { + long[] ac = seedActiveDB.cacheNodeFillStatus(); + long[] pa = seedPassiveDB.cacheNodeFillStatus(); + long[] po = seedPotentialDB.cacheNodeFillStatus(); + return new long[]{ac[0] + pa[0] + po[0], ac[1] + pa[1] + po[1], ac[2] + pa[2] + po[2], ac[3] + pa[3] + po[3]}; } public String[] dbCacheObjectStatus() {