diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java index a6f77729c66..a8db4ec100b 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @@ -287,12 +287,20 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo if (idleForMs>_maxIdleTime) { + // Don't idle out again until onIdleExpired task completes. + setCheckForIdle(false); _manager.dispatch(new Runnable() { public void run() { - onIdleExpired(idleForMs); - _idleTimestamp=System.currentTimeMillis(); + try + { + onIdleExpired(idleForMs); + } + finally + { + setCheckForIdle(true); + } } }); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java index c565ae4035e..49d6cf0cadb 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java @@ -30,7 +30,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import junit.framework.Assert; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.server.handler.AbstractHandler; @@ -39,6 +38,7 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.StdErrLog; import org.hamcrest.Matchers; +import org.junit.Assert; import org.junit.Test; import org.junit.matchers.JUnitMatchers; @@ -129,7 +129,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture // Read the response. String response=readResponse(client); - Assert.assertTrue(response.contains("HTTP/1.1 413 FULL head")); + Assert.assertThat(response, Matchers.containsString("HTTP/1.1 413 ")); } finally {