Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed missing thread name revert after balancer waiting
Michael Peter Christend7b17d8935b7
diff --git a/source/net/yacy/crawler/HostQueue.java b/source/net/yacy/crawler/HostQueue.javaindex 4594f2a4f..70d310891 100644--- a/source/net/yacy/crawler/HostQueue.java+++ b/source/net/yacy/crawler/HostQueue.java@@ -504,12 +504,14 @@ public class HostQueue implements Balancer {rest = rest + 1000 * loops;loops = 0;}+ final String tname = Thread.currentThread().getName();Thread.currentThread().setName("Balancer waiting for " + crawlEntry.url().getHost() + ": " + sleeptime + " milliseconds");if (rest > 0) {try {Thread.sleep(rest);} catch (final InterruptedException e) {}}for (int i = 0; i < loops; i++) {if (log.isInfo()) log.info("waiting for " + crawlEntry.url().getHost() + ": " + (loops - i) + " seconds remaining...");try {Thread.sleep(1000); } catch (final InterruptedException e) {}}+ Thread.currentThread().setName(tname); // restore the name so we do not see this in the thread dump as a waiting threadLatency.updateAfterSelection(crawlEntry.url(), robotsTime);}return crawlEntry;diff --git a/source/net/yacy/crawler/LegacyBalancer.java b/source/net/yacy/crawler/LegacyBalancer.javaindex c3a91e956..51394b55d 100644--- a/source/net/yacy/crawler/LegacyBalancer.java+++ b/source/net/yacy/crawler/LegacyBalancer.java@@ -426,7 +426,8 @@ public class LegacyBalancer implements Balancer {rest = rest + 1000 * loops;loops = 0;}- Thread.currentThread().setName("Balancer waiting for " +crawlEntry.url().getHost() + ": " + sleeptime + " milliseconds");+ final String tname = Thread.currentThread().getName();+ Thread.currentThread().setName("Balancer waiting for " + crawlEntry.url().getHost() + ": " + sleeptime + " milliseconds");synchronized(this) {// must be synchronized here to avoid 'takeover' moves from other threads which then idle the same time which would not be enoughif (rest > 0) {try {Thread.sleep(rest);} catch (final InterruptedException e) {}}@@ -435,6 +436,7 @@ public class LegacyBalancer implements Balancer {try {Thread.sleep(1000); } catch (final InterruptedException e) {}}}+ Thread.currentThread().setName(tname); // restore the name so we do not see this in the thread dump as a waiting threadLatency.updateAfterSelection(crawlEntry.url(), robotsTime);}return crawlEntry;