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();