From 5bfb408b7d921451af102a29c4e78ab438b2df89 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 11 Apr 2013 19:36:27 +0900 Subject: [PATCH] Add setRefCnt(int) method to AbstractReferenceCounted(ByteBuf) - Fixes #1265 --- .../java/io/netty/buffer/AbstractReferenceCounted.java | 7 +++++++ .../io/netty/buffer/AbstractReferenceCountedByteBuf.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/buffer/src/main/java/io/netty/buffer/AbstractReferenceCounted.java b/buffer/src/main/java/io/netty/buffer/AbstractReferenceCounted.java index cbde4dab02..e720c56ec2 100644 --- a/buffer/src/main/java/io/netty/buffer/AbstractReferenceCounted.java +++ b/buffer/src/main/java/io/netty/buffer/AbstractReferenceCounted.java @@ -56,6 +56,13 @@ public abstract class AbstractReferenceCounted implements ReferenceCounted { } } + /** + * An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly + */ + protected final void setRefCnt(int refCnt) { + this.refCnt = refCnt; + } + @Override public ReferenceCounted retain() { for (;;) { diff --git a/buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java b/buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java index 19b078d463..2558306dbe 100644 --- a/buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java +++ b/buffer/src/main/java/io/netty/buffer/AbstractReferenceCountedByteBuf.java @@ -61,6 +61,13 @@ public abstract class AbstractReferenceCountedByteBuf extends AbstractByteBuf { } } + /** + * An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly + */ + protected final void setRefCnt(int refCnt) { + this.refCnt = refCnt; + } + @Override public ByteBuf retain() { for (;;) {