You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/01/09 01:28:05 UTC

[bookkeeper] 03/03: BookieProtoEncoding: use retainedSlice() to reduce garbage

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

sijie pushed a commit to branch branch-4.6
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 42dca3bd72f2640f834515a67423c28596476304
Author: Samuel Just <sj...@salesforce.com>
AuthorDate: Mon Jan 8 16:10:45 2018 -0800

    BookieProtoEncoding: use retainedSlice() to reduce garbage
    
    Signed-off-by: Samuel Just <sjustsalesforce.com>
    
    Author: Samuel Just <sj...@salesforce.com>
    
    Reviewers: Sijie Guo <si...@apache.org>, Matteo Merli <mm...@apache.org>
    
    This closes #940 from athanatos/forupstream/requestprocessorfixes/3
---
 .../main/java/org/apache/bookkeeper/proto/BookieProtoEncoding.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtoEncoding.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtoEncoding.java
index df7f3b2..4f2b142 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtoEncoding.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieProtoEncoding.java
@@ -278,8 +278,8 @@ public class BookieProtoEncoding {
                 entryId = buffer.readLong();
 
                 if (rc == BookieProtocol.EOK) {
-                    ByteBuf content = buffer.slice();
-                    return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId, content.retain());
+                    return new BookieProtocol.ReadResponse(version, rc,
+                                                           ledgerId, entryId, buffer.retainedSlice());
                 } else {
                     return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId);
                 }

-- 
To stop receiving notification emails like this one, please contact
"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>.