You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by lu...@apache.org on 2022/12/22 08:34:44 UTC

[bookkeeper] branch master updated: [refactor][bookkeeper] Refactor ByteBuf release method in stream/storage (#3703)

This is an automated email from the ASF dual-hosted git repository.

lushiji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 5194c5bbd6 [refactor][bookkeeper] Refactor ByteBuf release method in stream/storage (#3703)
5194c5bbd6 is described below

commit 5194c5bbd62783dfb6f0b9c3a521194b4092e670
Author: Qiang Huang <qi...@gmail.com>
AuthorDate: Thu Dec 22 16:34:37 2022 +0800

    [refactor][bookkeeper] Refactor ByteBuf release method in stream/storage (#3703)
    
    * refactor ByteBuf release usage
---
 .../stream/storage/impl/routing/RoutingHeaderProxyInterceptor.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/routing/RoutingHeaderProxyInterceptor.java b/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/routing/RoutingHeaderProxyInterceptor.java
index 377f6df2c6..3c08f01598 100644
--- a/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/routing/RoutingHeaderProxyInterceptor.java
+++ b/stream/storage/impl/src/main/java/org/apache/bookkeeper/stream/storage/impl/routing/RoutingHeaderProxyInterceptor.java
@@ -37,6 +37,7 @@ import io.grpc.MethodDescriptor;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufInputStream;
 import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.util.ReferenceCountUtil;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -227,7 +228,7 @@ public class RoutingHeaderProxyInterceptor implements ClientInterceptor {
             buffer.writeBytes(is, bytes);
         } catch (IOException e) {
             log.warn("Encountered exceptions in transferring bytes to the buffer", e);
-            buffer.release();
+            ReferenceCountUtil.safeRelease(buffer);
             throw new RuntimeException("Encountered exceptions in transferring bytes to the buffer", e);
         }
         return method