diff --git a/defaults/yacy.init b/defaults/yacy.init index f8c4d3b76..26b1860a7 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -727,7 +727,7 @@ indexDistribution.dhtReceiptLimit = 10000 # Distribution of Citation-Reference (CR-) files # The distribution is done in two steps: # first step to anonymize the records -# second step to forward to collecting peer +# second step to forward to a collecting peer # to anonymize the data even against the intermediate peer # a specific precentage is also sent again to other peers. # for key-numbers please see de.anomic.plasma.plasmaRankingDistribution @@ -739,7 +739,7 @@ CRDist0Target = CRDist1Path = GLOBAL/014_othercr CRDist1Method = 9 CRDist1Percent = 30 -CRDist1Target = kaskelix.de:8080,yacy.dyndns.org:8000,suma-lab.de:8080 +CRDist1Target = kaskelix.de:8080,yacy.dyndns.org:8000 # Search sequence settings # collection: diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java index 81124a204..d7b2b88ca 100644 --- a/source/de/anomic/server/serverCore.java +++ b/source/de/anomic/server/serverCore.java @@ -66,8 +66,7 @@ import java.security.KeyStore; import java.util.ConcurrentModificationException; import java.util.Enumeration; import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; +import java.util.concurrent.ConcurrentHashMap; import javax.net.ssl.HandshakeCompletedEvent; import javax.net.ssl.HandshakeCompletedListener; @@ -120,6 +119,10 @@ public final class serverCore extends serverAbstractBusyThread implements server // static variables public static final Boolean TERMINATE_CONNECTION = Boolean.FALSE; public static final Boolean RESUME_CONNECTION = Boolean.TRUE; + + // Dummy value Object to use ConcurrentHashMap as HashSet + private static final Object PRESENT = new Object(); + /** * for brute-force prevention */ @@ -152,7 +155,7 @@ public final class serverCore extends serverAbstractBusyThread implements server HashMap denyHost; int commandMaxLength; private int maxBusySessions; - HashSet busySessions; + ConcurrentHashMap busySessions; /* private static ServerSocketFactory getServerSocketFactory(boolean dflt, File keyfile, String passphrase) { @@ -226,7 +229,7 @@ public final class serverCore extends serverAbstractBusyThread implements server // init session parameter maxBusySessions = Integer.valueOf(switchboard.getConfig("httpdMaxBusySessions","100")).intValue(); - busySessions = new HashSet(); + busySessions = new ConcurrentHashMap(); // init servercore init(); @@ -459,7 +462,7 @@ public final class serverCore extends serverAbstractBusyThread implements server // create session Session connection = new Session(sessionThreadGroup, controlSocket, this.timeout); - this.busySessions.add(connection); + this.busySessions.put(connection, PRESENT); } else { this.log.logWarning("ACCESS FROM " + cIP + " DENIED"); } @@ -481,7 +484,7 @@ public final class serverCore extends serverAbstractBusyThread implements server Thread.interrupted(); // shut down all busySessions - if (this.busySessions != null) for (Session session: this.busySessions) { + if (this.busySessions != null) for (Session session: this.busySessions.keySet()) { try { session.interrupt(); } catch (SecurityException e ) { @@ -513,10 +516,7 @@ public final class serverCore extends serverAbstractBusyThread implements server // close all sessions this.log.logInfo("Closing server sessions ..."); - Iterator i = this.busySessions.iterator(); - Session s; - while (i.hasNext()) { - s = i.next(); + for (Session s: this.busySessions.keySet()) { s.interrupt(); s.close(); }