- fix for ConcurrentModificationException during shutdown

- fix for Ranking distribution problem (suma-lab peer does not exist any more)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4749 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 27ab0a5f89
commit 75a1702133

@ -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:

@ -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<String, String> denyHost;
int commandMaxLength;
private int maxBusySessions;
HashSet<Session> busySessions;
ConcurrentHashMap<Session, Object> 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<Session>();
busySessions = new ConcurrentHashMap<Session, Object>();
// 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<Session> i = this.busySessions.iterator();
Session s;
while (i.hasNext()) {
s = i.next();
for (Session s: this.busySessions.keySet()) {
s.interrupt();
s.close();
}

Loading…
Cancel
Save