Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed http://forum.yacy-websuche.de/viewtopic.php?p=21113#p21113 fixed a concurrent modification exception during search and a time-out problem
orbiter93c535d1118c
diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.javaindex 5cdaf56d7..6ff684db6 100644--- a/source/de/anomic/crawler/Balancer.java+++ b/source/de/anomic/crawler/Balancer.java@@ -361,7 +361,7 @@ public class Balancer {//final int s = urlFileIndex.size();Row.Entry rowEntry = (nexthash == null) ? null : urlFileIndex.remove(nexthash);if (rowEntry == null) {- System.out.println("*** rowEntry=null, nexthash=" + new String(nexthash));+ //System.out.println("*** rowEntry=null, nexthash=" + new String(nexthash));rowEntry = urlFileIndex.removeOne();if (rowEntry == null) {nexthash = null;diff --git a/source/de/anomic/search/SearchEvent.java b/source/de/anomic/search/SearchEvent.javaindex d87ab65e6..7f629ff86 100644--- a/source/de/anomic/search/SearchEvent.java+++ b/source/de/anomic/search/SearchEvent.java@@ -467,9 +467,12 @@ public final class SearchEvent {public void run() {try {+ int t = 0;while (this.trigger.tryAcquire(10000, TimeUnit.MILLISECONDS)) {// a trigger was releasedprepareSecondarySearch();+ t++;+ if (t > 10) break;}} catch (InterruptedException e) {// the thread was interrupteddiff --git a/source/de/anomic/yacy/dht/PeerSelection.java b/source/de/anomic/yacy/dht/PeerSelection.javaindex e2a3d4381..a901da4ec 100755--- a/source/de/anomic/yacy/dht/PeerSelection.java+++ b/source/de/anomic/yacy/dht/PeerSelection.java@@ -350,7 +350,8 @@ public class PeerSelection {while ((s.hasNext()) && (searchcount-- > 0)) {ys = s.next();if ((ys != null) && (ys.get(yacySeed.LASTSEEN, "").length() > 10)) try {- absage = Math.abs(System.currentTimeMillis() + DateFormatter.dayMillis - ys.getLastSeenUTC());+ absage = Math.abs(System.currentTimeMillis() + DateFormatter.dayMillis - ys.getLastSeenUTC()) / 1000 / 60;+ if (absage > Integer.MAX_VALUE) absage = Integer.MAX_VALUE;seedScore.inc(ys.hash, (int) absage); // the higher absage, the older is the peer} catch (final Exception e) {}}diff --git a/source/net/yacy/kelondro/util/SetTools.java b/source/net/yacy/kelondro/util/SetTools.javaindex 30ef3987b..7c5806e83 100644--- a/source/net/yacy/kelondro/util/SetTools.java+++ b/source/net/yacy/kelondro/util/SetTools.java@@ -33,6 +33,7 @@ import java.io.InputStreamReader;import java.util.ArrayList;import java.util.Collection;import java.util.Comparator;+import java.util.ConcurrentModificationException;import java.util.Iterator;import java.util.Map;import java.util.Set;@@ -40,6 +41,7 @@ import java.util.TreeMap;import java.util.TreeSet;import net.yacy.kelondro.index.HandleSet;+import net.yacy.kelondro.logging.Log;public class SetTools {@@ -133,16 +135,23 @@ public class SetTools {private final static <A, B> TreeMap<A, B> joinConstructiveByTest(final TreeMap<A, B> small, final TreeMap<A, B> large, final boolean concatStrings) {final Iterator<Map.Entry<A, B>> mi = small.entrySet().iterator();final TreeMap<A, B> result = new TreeMap<A, B>(large.comparator());- Map.Entry<A, B> mentry1;- B mobj2;- while (mi.hasNext()) {- mentry1 = mi.next();- mobj2 = large.get(mentry1.getKey());- if (mobj2 != null) {- if (mentry1.getValue() instanceof String) {- result.put(mentry1.getKey(), (B) ((concatStrings) ? (mentry1.getValue() + (String) mobj2) : mentry1.getValue()));- } else {- result.put(mentry1.getKey(), mentry1.getValue());+ synchronized (mi) {+ Map.Entry<A, B> mentry1;+ B mobj2;+ loop: while (mi.hasNext()) {+ try {+ mentry1 = mi.next();+ mobj2 = large.get(mentry1.getKey());+ if (mobj2 != null) {+ if (mentry1.getValue() instanceof String) {+ result.put(mentry1.getKey(), (B) ((concatStrings) ? (mentry1.getValue() + (String) mobj2) : mentry1.getValue()));+ } else {+ result.put(mentry1.getKey(), mentry1.getValue());+ }+ }+ } catch (ConcurrentModificationException e) {+ Log.logWarning("SetTools", e.getMessage(), e);+ break loop;}}}