diff --git a/VERSION.txt b/VERSION.txt index b3ce816ee9f..92c169a2f30 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -8,6 +8,7 @@ jetty-7.0.0.M2-SNAPSHOT + JETTY-1003 java.lang.IllegalArgumentException: timeout can't be negative + JETTY-1004 CERT VU#402580 Canonical path handling includes ? in path segment + JETTY-1014 Enable start-stop-daemon by default on jetty.sh (START_STOP_DAEMON=1) + + JETTY-1015 Reduce BayeuxClient and HttpClient lock contention jetty-6.1.17 30 April 2009 + JETTY-936 Make optional dispatching to welcome files as servlets diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java index f717c474f07..9dd43482e3c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java @@ -204,26 +204,27 @@ public class HttpDestination /* ------------------------------------------------------------------------------- */ public HttpConnection getIdleConnection() throws IOException { - synchronized (this) + long now = System.currentTimeMillis(); + long idleTimeout=_client.getIdleTimeout(); + HttpConnection connection = null; + while (true) { - long now = System.currentTimeMillis(); - long idleTimeout = _client.getIdleTimeout(); - - // Find an idle connection - while (_idle.size() > 0) + synchronized (this) { - HttpConnection connection = _idle.remove(_idle.size() - 1); - long last = connection.getLast(); - if (connection.getEndPoint().isOpen() && (last == 0 || ((now - last) < idleTimeout))) - return connection; - else - { - _connections.remove(connection); - connection.getEndPoint().close(); - } + if (_idle.size() > 0) + connection = _idle.remove(_idle.size()-1); } + + if (connection==null) + return null; - return null; + long last = connection.getLast(); + if (connection.getEndPoint().isOpen() && (last==0 || ((now-last)