From 1070476469983e228ffba44095523328b9df3c18 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 23 Feb 2011 00:15:56 +0000 Subject: [PATCH] 337898 set client HttpConnection max idle time from exchange timeout git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2821 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 2 +- .../main/java/org/eclipse/jetty/client/HttpConnection.java | 5 +++++ .../java/org/eclipse/jetty/client/TimeoutExchangeTest.java | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 1a16327fa06..8b3c30db1af 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -16,7 +16,7 @@ jetty-7.3.1-SNAPSHOT + 337784 Improve HashSessionManager for session migrations + 337878 Extra tests of security constraints + 337896 HttpExchange.timeout does not override HttpClient.timeout - + 337898 increase client test timeout + + 337898 set client HttpConnection max idle time from exchange timeout + JETTY-1331 Allow alternate XML configuration processors (eg spring) + JETTY-1335 HttpClient's SelectConnector clean-up diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java index 993348b52b5..63c60b8d97c 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java @@ -135,6 +135,8 @@ public class HttpConnection implements Connection long exchTimeout = _exchange.getTimeout(); if (exchTimeout > 0) { + if (exchTimeout!=_destination.getHttpClient().getTimeout()) + _endp.setMaxIdleTime((int)exchTimeout); _destination.getHttpClient().schedule(_timeout, exchTimeout); } else @@ -352,7 +354,10 @@ public class HttpConnection implements Connection { HttpExchange exchange=_exchange; _exchange.disassociate(); + if (_exchange.getTimeout()>0 && _exchange.getTimeout()!=getDestination().getHttpClient().getTimeout()) + _endp.setMaxIdleTime((int)getDestination().getHttpClient().getTimeout()); _exchange = null; + if (_status==HttpStatus.SWITCHING_PROTOCOLS_101) { diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java index e8d3889f8dd..e18476a64df 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/TimeoutExchangeTest.java @@ -145,7 +145,7 @@ public class TimeoutExchangeTest @Test public void testExchangeTimeoutNotExpiring() throws Exception { - startClient(2000); + startClient(500); long serverSleep = 1000; long exchangeTimeout = 1500; @@ -165,7 +165,7 @@ public class TimeoutExchangeTest @Test public void testExchangeTimeoutExpiring() throws Exception { - startClient(2000); + startClient(5000); long serverSleep = 1000; long exchangeTimeout = 500;