Skip to content

Commit

Permalink
Connections_p.html: better formatting and remove very old entries
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4684 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
danielr committed Apr 12, 2008
1 parent 82bf9ac commit 2617f4d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .classpath
Expand Up @@ -38,6 +38,10 @@
<classpathentry kind="lib" path="libx/FontBox-0.1.0-dev.jar"/>
<classpathentry kind="lib" path="libx/bcprov-jdk14-132.jar"/>
<classpathentry kind="lib" path="libx/commons-codec-1.3.jar"/>
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar" sourcepath="doc/commons-httpclient-3.1/src">
<attributes>
<attribute name="javadoc_location" value="file:/home/daniel/workspace/yacy/doc/commons-httpclient-3.1/docs/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="gen"/>
</classpath>
3 changes: 2 additions & 1 deletion defaults/yacy.init
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions source/de/anomic/http/HttpConnectionInfo.java
Expand Up @@ -42,6 +42,7 @@ public class HttpConnectionInfo {
*/
private final static Set<HttpConnectionInfo> allConnections = Collections
.synchronizedSet(new HashSet<HttpConnectionInfo>());
private final static int staleAfterMillis = 1800 * 1000;

private final String protocol;
private final String targetHost;
Expand Down Expand Up @@ -143,6 +144,19 @@ public static void removeConnection(final int id) {
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()
*/
Expand Down
6 changes: 4 additions & 2 deletions source/de/anomic/http/JakartaCommonsHttpClient.java
Expand Up @@ -431,8 +431,9 @@ private HttpConnectionInfo generateConInfo(final HttpMethod method) {
} 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());
}

/**
Expand Down Expand Up @@ -593,6 +594,7 @@ public static void cleanup() {
lastCleanup = now;
conManager.closeIdleConnections(120000);
conManager.deleteClosedConnections();
HttpConnectionInfo.cleanUp();
}
}
}
2 changes: 1 addition & 1 deletion startYACY.sh
Expand Up @@ -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
Expand Down

0 comments on commit 2617f4d

Please sign in to comment.