From ccb3582edb7f7254f5712e50c861b995881123a5 Mon Sep 17 00:00:00 2001 From: chenby Date: Wed, 28 Oct 2020 13:02:14 +0800 Subject: [PATCH] Fix issue #5499 this PR let the ByteAccumulator recyclable. after invoke ByteAccumulator.transferTo method we can invoke ByteAccumulator.recycle method to reuse byte[] via ByteAccumulator.newByteArray method Signed-off-by: Baoyi Chen --- .../websocket/common/extensions/compress/ByteAccumulator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulator.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulator.java index 53362ba36cb9..b76f7595129f 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulator.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulator.java @@ -96,6 +96,7 @@ public void transferTo(ByteBuffer buffer) void recycle() { index = 0; + length = 0; prevChunks = nextChunks; nextChunks = new ArrayList<>(); }