From e67532372c25717ee58343f272f17ef0b40afc25 Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Thu, 20 Jun 2019 09:09:20 +1000 Subject: [PATCH] Issue #300 - ensure Sessions are stopped before CompressionPools Signed-off-by: Lachlan Roberts --- .../eclipse/jetty/util/compression/CompressionPool.java | 2 +- .../eclipse/jetty/websocket/client/WebSocketClient.java | 2 ++ .../jetty/websocket/server/WebSocketServerFactory.java | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/compression/CompressionPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/compression/CompressionPool.java index 6582f5d3a90..35f67dbe816 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/compression/CompressionPool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/compression/CompressionPool.java @@ -88,7 +88,7 @@ public abstract class CompressionPool extends AbstractLifeCycle if (object == null) return; - if (_capacity == 0) + if (_capacity == 0 || isStopped()) { end(object); return; diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java index 1e025c53ac2..3fd91049aaa 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java +++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java @@ -400,6 +400,8 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont ShutdownThread.deregister(this); + sessionTracker.stop(); + extensionRegistry.stop(); super.doStop(); if (LOG.isDebugEnabled()) diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java index 4755b5c3306..022811a6c2a 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java @@ -338,6 +338,14 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc super.doStart(); } + @Override + protected void doStop() throws Exception + { + sessionTracker.stop(); + extensionFactory.stop(); + super.doStop(); + } + /** * Attempt to find the DecoratedObjectFactory that should be used. * @return the DecoratedObjectFactory that should be used. (never null)