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 33d219655ea..4953464368c 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 @@ -923,12 +923,12 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory protected InflaterPool newInflaterPool() { - return new InflaterPool(CompressionPool.INFINITE_CAPACITY, true); + return new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true); } protected DeflaterPool newDeflaterPool() { - return new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true); + return new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true); } @Override 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 ebf14c6301b..34439d10895 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 @@ -25,7 +25,7 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle; public abstract class CompressionPool extends AbstractLifeCycle { - public static final int INFINITE_CAPACITY = Integer.MAX_VALUE; + public static final int DEFAULT_CAPACITY = 1024; private int _capacity; private Pool _pool; diff --git a/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java index 325132b097b..5b769e2d118 100644 --- a/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java +++ b/jetty-websocket/websocket-core-common/src/main/java/org/eclipse/jetty/websocket/core/WebSocketComponents.java @@ -42,8 +42,8 @@ public class WebSocketComponents public WebSocketComponents() { this(new WebSocketExtensionRegistry(), new DecoratedObjectFactory(), new MappedByteBufferPool(), - new InflaterPool(CompressionPool.INFINITE_CAPACITY, true), - new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true)); + new InflaterPool(CompressionPool.DEFAULT_CAPACITY, true), + new DeflaterPool(CompressionPool.DEFAULT_CAPACITY, Deflater.DEFAULT_COMPRESSION, true)); } public WebSocketComponents(WebSocketExtensionRegistry extensionRegistry, DecoratedObjectFactory objectFactory, diff --git a/tests/jetty-jmh/src/main/java/org/eclipse/jetty/server/jmh/DeflaterPoolBenchmark.java b/tests/jetty-jmh/src/main/java/org/eclipse/jetty/server/jmh/DeflaterPoolBenchmark.java index a0b14daa79b..36fb06cd1ac 100644 --- a/tests/jetty-jmh/src/main/java/org/eclipse/jetty/server/jmh/DeflaterPoolBenchmark.java +++ b/tests/jetty-jmh/src/main/java/org/eclipse/jetty/server/jmh/DeflaterPoolBenchmark.java @@ -49,7 +49,7 @@ public class DeflaterPoolBenchmark public static final String COMPRESSION_STRING = "hello world"; DeflaterPool _pool; - @Param({"NO_POOL", "DEFLATER_POOL_10", "DEFLATER_POOL_20", "DEFLATER_POOL_50"}) + @Param({"NO_POOL", "DEFLATER_POOL_10", "DEFLATER_POOL_20", "DEFLATER_POOL_50", "DEFLATER_POOL_DEFAULT"}) public static String poolType; @Setup(Level.Trial) @@ -75,6 +75,10 @@ public class DeflaterPoolBenchmark capacity = 50; break; + case "DEFLATER_POOL_DEFAULT": + capacity = DeflaterPool.DEFAULT_CAPACITY; + break; + default: throw new IllegalStateException("Unknown poolType Parameter"); }