diff --git a/.classpath b/.classpath index c93b44b06..0c728756b 100644 --- a/.classpath +++ b/.classpath @@ -38,6 +38,10 @@ - + + + + + diff --git a/defaults/yacy.init b/defaults/yacy.init index b15082f0a..1f79da9e3 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -70,7 +70,8 @@ server.maxTrackingTime = 3600000 # The property here can also be a url where the definition can be loaded. # In case of privately managed networks, this configuration must be changed BEFORE it is released # to the members of the separated network peers. -network.unit.definition = defaults/yacy.network.freeworld.unit +#network.unit.definition = defaults/yacy.network.freeworld.unit +network.unit.definition = defaults/yacy.network.intranet.unit network.group.definition = defaults/yacy.network.group # Update process properties diff --git a/source/de/anomic/http/HttpConnectionInfo.java b/source/de/anomic/http/HttpConnectionInfo.java index c5c1ed4e1..fa75cf664 100644 --- a/source/de/anomic/http/HttpConnectionInfo.java +++ b/source/de/anomic/http/HttpConnectionInfo.java @@ -42,6 +42,7 @@ public class HttpConnectionInfo { */ private final static Set allConnections = Collections .synchronizedSet(new HashSet()); + private final static int staleAfterMillis = 1800 * 1000; private final String protocol; private final String targetHost; @@ -143,6 +144,19 @@ public class HttpConnectionInfo { removeConnection(new HttpConnectionInfo(null, null, null, id, 0)); } + /** + * removes stale connections + */ + public static void cleanUp() { + synchronized (allConnections) { + for(HttpConnectionInfo con: allConnections) { + if(con.getLifetime() > staleAfterMillis) { + allConnections.remove(con); + } + } + } + } + /* (non-Javadoc) * @see java.lang.Object#toString() */ diff --git a/source/de/anomic/http/JakartaCommonsHttpClient.java b/source/de/anomic/http/JakartaCommonsHttpClient.java index ea1785c8d..3d1866bd2 100644 --- a/source/de/anomic/http/JakartaCommonsHttpClient.java +++ b/source/de/anomic/http/JakartaCommonsHttpClient.java @@ -431,8 +431,9 @@ public class JakartaCommonsHttpClient { } catch (final URIException e) { // should not happen, because method is already executed } - return new HttpConnectionInfo(protocol, (port == 80) ? host : host + ":" + port, method.getName() + " " + - method.getPath() + "?" + method.getQueryString(), method.hashCode(), System.currentTimeMillis()); + final String query = (method.getQueryString() != null) ? "?" + method.getQueryString() : ""; + return new HttpConnectionInfo(protocol, (port == -1 || port == 80) ? host : host + ":" + port, method.getName() + " " + + method.getPath() + query, method.hashCode(), System.currentTimeMillis()); } /** @@ -593,6 +594,7 @@ public class JakartaCommonsHttpClient { lastCleanup = now; conManager.closeIdleConnections(120000); conManager.deleteClosedConnections(); + HttpConnectionInfo.cleanUp(); } } } \ No newline at end of file diff --git a/startYACY.sh b/startYACY.sh index ac3527a37..8fb0656b2 100755 --- a/startYACY.sh +++ b/startYACY.sh @@ -77,7 +77,7 @@ done #echo $options;exit 0 #DEBUG for getopts #get javastart args -JAVA_ARGS="" +JAVA_ARGS="-ea" if [ ! -f $CONFIGFILE -a -f DATA/SETTINGS/httpProxy.conf ] then # old config if new does not exist