|
|
@ -42,6 +42,7 @@ public class HttpConnectionInfo {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private final static Set<HttpConnectionInfo> allConnections = Collections
|
|
|
|
private final static Set<HttpConnectionInfo> allConnections = Collections
|
|
|
|
.synchronizedSet(new HashSet<HttpConnectionInfo>());
|
|
|
|
.synchronizedSet(new HashSet<HttpConnectionInfo>());
|
|
|
|
|
|
|
|
private final static int staleAfterMillis = 1800 * 1000;
|
|
|
|
|
|
|
|
|
|
|
|
private final String protocol;
|
|
|
|
private final String protocol;
|
|
|
|
private final String targetHost;
|
|
|
|
private final String targetHost;
|
|
|
@ -143,6 +144,19 @@ public class HttpConnectionInfo {
|
|
|
|
removeConnection(new HttpConnectionInfo(null, null, null, id, 0));
|
|
|
|
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)
|
|
|
|
/* (non-Javadoc)
|
|
|
|
* @see java.lang.Object#toString()
|
|
|
|
* @see java.lang.Object#toString()
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|