From 93db832207b247fd8f90785ab0c6032bd2300468 Mon Sep 17 00:00:00 2001 From: Baoyi Chen Date: Fri, 30 Oct 2020 16:15:35 +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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3e40d0b673af..e3664721420c 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 @@ -62,7 +62,7 @@ public void copyChunk(ByteBuffer buffer) { // release 0 length buffer directly if (bufferPool != null) - bufferPool.release((ByteBuffer)buffer.clear()); + bufferPool.release(buffer); } } @@ -122,7 +122,7 @@ void recycle() } for (ByteBuffer chunk : chunks) { - bufferPool.release((ByteBuffer)chunk.clear()); + bufferPool.release(chunk); } chunks.clear();