From 6cf6b78a16ee42d3f27555c88b63be9c36ae3110 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 17 Sep 2020 10:27:15 -0500 Subject: [PATCH] Issue #5246 - Adding DeflaterPool to GzipHandler.dump Signed-off-by: Joakim Erdfelt --- .../jetty/server/handler/gzip/GzipHandler.java | 1 + .../jetty/util/compression/CompressionPool.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java index 72b987a7ed9..516c556b89f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java @@ -421,6 +421,7 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory protected void doStart() throws Exception { _deflaterPool = newDeflaterPool(_poolCapacity); + addBean(_deflaterPool); _vary = (_agentPatterns.size() > 0) ? GzipHttpOutputInterceptor.VARY_ACCEPT_ENCODING_USER_AGENT : GzipHttpOutputInterceptor.VARY_ACCEPT_ENCODING; super.doStart(); } 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 cf35e73d79f..e73ddd316db 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 @@ -125,4 +125,17 @@ public abstract class CompressionPool extends AbstractLifeCycle } _numObjects.set(0); } + + @Override + public String toString() + { + StringBuilder str = new StringBuilder(); + str.append(getClass().getSimpleName()); + str.append('@').append(Integer.toHexString(hashCode())); + str.append('{').append(getState()); + str.append(",size=").append(_pool == null ? -1 : _pool.size()); + str.append(",capacity=").append(_capacity <= 0 ? "UNLIMITED" : _capacity); + str.append('}'); + return str.toString(); + } }