From ea14de47b759a140da587dbcd94430b6aad7433e Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 9 Feb 2010 11:38:25 +0000 Subject: [PATCH] improved timeout handling git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1252 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../org/eclipse/jetty/io/nio/SelectChannelEndPoint.java | 6 ++++-- .../java/org/eclipse/jetty/server/AbstractConnector.java | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 8089f978ec0..b12fe6c1418 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 @@ -286,7 +286,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements Runnable, updateKey(); this.wait(timeoutMs); - if (_readBlocked && timeoutMs<(_selectSet.getNow()-start)) + timeoutMs -= _selectSet.getNow()-start; + if (_readBlocked && timeoutMs<=0) return false; } catch (InterruptedException e) @@ -323,7 +324,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements Runnable, updateKey(); this.wait(timeoutMs); - if (_writeBlocked && timeoutMs<(_selectSet.getNow()-start)) + timeoutMs -= _selectSet.getNow()-start; + if (_writeBlocked && timeoutMs<=0) return false; } catch (InterruptedException e) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index 84892e43fc2..35b5a68162c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -377,9 +377,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector { try{close();} catch(IOException e) {Log.warn(e);} - if (_threadPool==_server.getThreadPool()) - _threadPool=null; - else if (_threadPool instanceof LifeCycle) + if (_threadPool!=_server.getThreadPool() && _threadPool instanceof LifeCycle) ((LifeCycle)_threadPool).stop(); super.doStop();