From e80e060ca65b679ee4a9c23965604320fed21b45 Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 19 Jan 2010 11:29:22 +0000 Subject: [PATCH] - increased thread priority for server threads - decreased thread priority for crawler threads git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6596 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/crawler/CrawlQueues.java | 1 + source/de/anomic/crawler/ResultURLs.java | 8 +++++--- source/de/anomic/server/serverCore.java | 1 + source/net/yacy/kelondro/blob/BEncodedHeap.java | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.java index d4695f96a..b378f2cd5 100644 --- a/source/de/anomic/crawler/CrawlQueues.java +++ b/source/de/anomic/crawler/CrawlQueues.java @@ -533,6 +533,7 @@ public class CrawlQueues { workers.put(code, this); this.start(); } + this.setPriority(Thread.MIN_PRIORITY); // http requests from the crawler should not cause that other functions work worse } public long age() { diff --git a/source/de/anomic/crawler/ResultURLs.java b/source/de/anomic/crawler/ResultURLs.java index 4ae7c37ca..e32d2079c 100644 --- a/source/de/anomic/crawler/ResultURLs.java +++ b/source/de/anomic/crawler/ResultURLs.java @@ -137,8 +137,8 @@ public final class ResultURLs { */ public synchronized String getHashNo(final EventOrigin stack, final int pos, final int index) { final String result = getResultStackAt(stack, pos); - if(result != null) { - if(result.length() < Word.commonHashLength * 3) { + if (result != null) { + if (result.length() < Word.commonHashLength * 3) { Log.logSevere("ResultURLs", "unexpected error: result of stack is too short: "+ result.length()); if(result.length() <= Word.commonHashLength * 2) { return null; @@ -189,8 +189,10 @@ public final class ResultURLs { public int deleteDomain(final EventOrigin stack, String host, String hosthash) { assert hosthash.length() == 6; int i = 0; + String urlhash; while (i < getStackSize(stack)) { - if (getUrlHash(stack, i).substring(6).equals(hosthash)) getStack(stack).remove(i); else i++; + urlhash = getUrlHash(stack, i); + if (urlhash == null || urlhash.substring(6).equals(hosthash)) getStack(stack).remove(i); else i++; } assert host != null : "host = null"; assert getDomains(stack) != null : "getDomains(" + stack + ") = null"; diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java index 631d3eb85..e4cf23329 100644 --- a/source/de/anomic/server/serverCore.java +++ b/source/de/anomic/server/serverCore.java @@ -498,6 +498,7 @@ public final class serverCore extends AbstractBusyThread implements BusyThread { public Session(final ThreadGroup theThreadGroup, final Socket controlSocket, final int socketTimeout) { super(theThreadGroup, controlSocket.getInetAddress().toString() + "@" + Long.toString(System.currentTimeMillis())); + this.setPriority(Thread.MAX_PRIORITY); this.socketTimeout = socketTimeout; this.controlSocket = controlSocket; this.hashIndex = sessionCounter; diff --git a/source/net/yacy/kelondro/blob/BEncodedHeap.java b/source/net/yacy/kelondro/blob/BEncodedHeap.java index e098dc60c..f27110c2a 100644 --- a/source/net/yacy/kelondro/blob/BEncodedHeap.java +++ b/source/net/yacy/kelondro/blob/BEncodedHeap.java @@ -104,7 +104,7 @@ public class BEncodedHeap implements Iterable b2m(byte[] b) { + static Map b2m(byte[] b) { if (b == null) return null; System.out.println("b = " + new String(b)); BDecoder decoder = new BDecoder(b);