You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/02/08 22:32:01 UTC

[incubator-pulsar] branch master updated: Use duplicates when writing from ByteBuf pair to avoid multiple threads issues (#1203)

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

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new feb0acc  Use duplicates when writing from ByteBuf pair to avoid multiple threads issues (#1203)
feb0acc is described below

commit feb0acc608318fe6f878a2e00dcce9cb0085a79a
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Thu Feb 8 14:31:58 2018 -0800

    Use duplicates when writing from ByteBuf pair to avoid multiple threads issues (#1203)
---
 .../src/main/java/org/apache/pulsar/common/api/ByteBufPair.java       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java b/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java
index 297b562..94e1fb7 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java
@@ -121,8 +121,8 @@ public final class ByteBufPair extends AbstractReferenceCounted {
                 // ByteBuf are automatically released after a write. If the ByteBufPair ref count is increased and it
                 // gets written multiple times, the individual buffers refcount should be reflected as well.
                 try {
-                    ctx.write(b.getFirst().retain(), ctx.voidPromise());
-                    ctx.write(b.getSecond().retain(), promise);
+                    ctx.write(b.getFirst().retainedDuplicate(), ctx.voidPromise());
+                    ctx.write(b.getSecond().retainedDuplicate(), promise);
                 } finally {
                     ReferenceCountUtil.safeRelease(b);
                 }

-- 
To stop receiving notification emails like this one, please contact
mmerli@apache.org.