diff --git a/buffer/src/main/java/io/netty/buffer/ByteBufHolder.java b/buffer/src/main/java/io/netty/buffer/ByteBufHolder.java index 4c6fbb3fcb..7dea904baa 100644 --- a/buffer/src/main/java/io/netty/buffer/ByteBufHolder.java +++ b/buffer/src/main/java/io/netty/buffer/ByteBufHolder.java @@ -32,6 +32,11 @@ public interface ByteBufHolder extends ReferenceCounted { */ ByteBufHolder copy(); + /** + * Duplicate the {@link ByteBufHolder}. Be aware that this will not automatically call {@link #retain()}. + */ + ByteBufHolder duplicate(); + @Override ByteBufHolder retain(); diff --git a/buffer/src/main/java/io/netty/buffer/DefaultByteBufHolder.java b/buffer/src/main/java/io/netty/buffer/DefaultByteBufHolder.java index 51314a63a7..9b615f2bb0 100644 --- a/buffer/src/main/java/io/netty/buffer/DefaultByteBufHolder.java +++ b/buffer/src/main/java/io/netty/buffer/DefaultByteBufHolder.java @@ -45,6 +45,11 @@ public class DefaultByteBufHolder implements ByteBufHolder { return new DefaultByteBufHolder(data.copy()); } + @Override + public ByteBufHolder duplicate() { + return new DefaultByteBufHolder(data.duplicate()); + } + @Override public int refCnt() { return data.refCnt(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpRequest.java b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpRequest.java index 08e2458d8c..c2a1843066 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpRequest.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpRequest.java @@ -100,4 +100,13 @@ public class DefaultFullHttpRequest extends DefaultHttpRequest implements FullHt copy.trailingHeaders().set(trailingHeaders()); return copy; } + + @Override + public FullHttpRequest duplicate() { + DefaultFullHttpRequest duplicate = new DefaultFullHttpRequest( + getProtocolVersion(), getMethod(), getUri(), content().duplicate()); + duplicate.headers().set(headers()); + duplicate.trailingHeaders().set(trailingHeaders()); + return duplicate; + } } diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpResponse.java b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpResponse.java index acb728b7fc..fe12c234e2 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpResponse.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultFullHttpResponse.java @@ -95,4 +95,13 @@ public class DefaultFullHttpResponse extends DefaultHttpResponse implements Full copy.trailingHeaders().set(trailingHeaders()); return copy; } + + @Override + public FullHttpResponse duplicate() { + DefaultFullHttpResponse duplicate = new DefaultFullHttpResponse(getProtocolVersion(), getStatus(), + content().duplicate()); + duplicate.headers().set(headers()); + duplicate.trailingHeaders().set(trailingHeaders()); + return duplicate; + } } diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpContent.java b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpContent.java index d6ebe5f445..df63af4c70 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpContent.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpContent.java @@ -44,6 +44,11 @@ public class DefaultHttpContent extends DefaultHttpObject implements HttpContent return new DefaultHttpContent(content.copy()); } + @Override + public HttpContent duplicate() { + return new DefaultHttpContent(content.duplicate()); + } + @Override public int refCnt() { return content.refCnt(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultLastHttpContent.java b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultLastHttpContent.java index 34056745d0..fbc47f6a12 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultLastHttpContent.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultLastHttpContent.java @@ -54,6 +54,13 @@ public class DefaultLastHttpContent extends DefaultHttpContent implements LastHt return copy; } + @Override + public LastHttpContent duplicate() { + DefaultLastHttpContent copy = new DefaultLastHttpContent(content().duplicate()); + copy.trailingHeaders().set(trailingHeaders()); + return copy; + } + @Override public LastHttpContent retain(int increment) { super.retain(increment); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpContent.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpContent.java index e0e969f5b3..dddb5b1f76 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpContent.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpContent.java @@ -30,6 +30,9 @@ public interface HttpContent extends HttpObject, ByteBufHolder { @Override HttpContent copy(); + @Override + HttpContent duplicate(); + @Override HttpContent retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/LastHttpContent.java b/codec-http/src/main/java/io/netty/handler/codec/http/LastHttpContent.java index d7a935238f..9f490def37 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/LastHttpContent.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/LastHttpContent.java @@ -39,6 +39,11 @@ public interface LastHttpContent extends HttpContent { return EMPTY_LAST_CONTENT; } + @Override + public LastHttpContent duplicate() { + return this; + } + @Override public HttpHeaders trailingHeaders() { return HttpHeaders.EMPTY_HEADERS; diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/Attribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/Attribute.java index dec7e119ef..365c18f67e 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/Attribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/Attribute.java @@ -34,6 +34,9 @@ public interface Attribute extends HttpData { @Override Attribute copy(); + @Override + Attribute duplicate(); + @Override Attribute retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java index a57cfa38a9..28ac87044b 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java @@ -155,6 +155,21 @@ public class DiskAttribute extends AbstractDiskHttpData implements Attribute { return attr; } + @Override + public Attribute duplicate() { + DiskAttribute attr = new DiskAttribute(getName()); + attr.setCharset(getCharset()); + ByteBuf content = content(); + if (content != null) { + try { + attr.setContent(content.duplicate()); + } catch (IOException e) { + throw new ChannelException(e); + } + } + return attr; + } + @Override public Attribute retain(int increment) { super.retain(increment); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java index c452ca64bf..69cb190deb 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskFileUpload.java @@ -178,6 +178,21 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload { return upload; } + @Override + public FileUpload duplicate() { + DiskFileUpload upload = new DiskFileUpload(getName(), + getFilename(), getContentType(), getContentTransferEncoding(), getCharset(), size); + ByteBuf buf = content(); + if (buf != null) { + try { + upload.setContent(buf.duplicate()); + } catch (IOException e) { + throw new ChannelException(e); + } + } + return upload; + } + @Override public FileUpload retain(int increment) { super.retain(increment); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/FileUpload.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/FileUpload.java index 82561ed76e..9abc9bbf2b 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/FileUpload.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/FileUpload.java @@ -59,6 +59,9 @@ public interface FileUpload extends HttpData { @Override FileUpload copy(); + @Override + FileUpload duplicate(); + @Override FileUpload retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpData.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpData.java index 47e3826581..3a6c9b49d4 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpData.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpData.java @@ -180,6 +180,9 @@ public interface HttpData extends InterfaceHttpData, ByteBufHolder { @Override HttpData copy(); + @Override + HttpData duplicate(); + @Override HttpData retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java index adf46f5f24..f5269f7edd 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java @@ -1145,6 +1145,15 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput return copy; } + @Override + public FullHttpRequest duplicate() { + DefaultFullHttpRequest duplicate = new DefaultFullHttpRequest( + getProtocolVersion(), getMethod(), getUri(), content().duplicate()); + duplicate.headers().set(headers()); + duplicate.trailingHeaders().set(trailingHeaders()); + return duplicate; + } + @Override public FullHttpRequest retain(int increment) { content.retain(increment); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java index de556c40a4..e174ac91f4 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryAttribute.java @@ -116,6 +116,21 @@ public class MemoryAttribute extends AbstractMemoryHttpData implements Attribute return attr; } + @Override + public Attribute duplicate() { + MemoryAttribute attr = new MemoryAttribute(getName()); + attr.setCharset(getCharset()); + ByteBuf content = content(); + if (content != null) { + try { + attr.setContent(content.duplicate()); + } catch (IOException e) { + throw new ChannelException(e); + } + } + return attr; + } + @Override public Attribute retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryFileUpload.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryFileUpload.java index 368e3c8982..a9ad28b1f4 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryFileUpload.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MemoryFileUpload.java @@ -145,6 +145,21 @@ public class MemoryFileUpload extends AbstractMemoryHttpData implements FileUplo return upload; } + @Override + public FileUpload duplicate() { + MemoryFileUpload upload = new MemoryFileUpload(getName(), getFilename(), getContentType(), + getContentTransferEncoding(), getCharset(), size); + ByteBuf buf = content(); + if (buf != null) { + try { + upload.setContent(buf.duplicate()); + return upload; + } catch (IOException e) { + throw new ChannelException(e); + } + } + return upload; + } @Override public FileUpload retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedAttribute.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedAttribute.java index f14a91f8e7..e47e548693 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedAttribute.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedAttribute.java @@ -204,6 +204,11 @@ public class MixedAttribute implements Attribute { return attribute.copy(); } + @Override + public Attribute duplicate() { + return attribute.duplicate(); + } + @Override public ByteBuf content() { return attribute.content(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedFileUpload.java b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedFileUpload.java index 56881d5c2e..b3e2638c3d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedFileUpload.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/multipart/MixedFileUpload.java @@ -230,6 +230,11 @@ public class MixedFileUpload implements FileUpload { return fileUpload.copy(); } + @Override + public FileUpload duplicate() { + return fileUpload.duplicate(); + } + @Override public ByteBuf content() { return fileUpload.content(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java index cc461c2f12..da7392a38e 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/BinaryWebSocketFrame.java @@ -59,6 +59,11 @@ public class BinaryWebSocketFrame extends WebSocketFrame { return new BinaryWebSocketFrame(isFinalFragment(), rsv(), content().copy()); } + @Override + public BinaryWebSocketFrame duplicate() { + return new BinaryWebSocketFrame(isFinalFragment(), rsv(), content().duplicate()); + } + @Override public BinaryWebSocketFrame retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java index 6d90e366c4..8d6c56b2cd 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/CloseWebSocketFrame.java @@ -143,6 +143,11 @@ public class CloseWebSocketFrame extends WebSocketFrame { return new CloseWebSocketFrame(isFinalFragment(), rsv(), content().copy()); } + @Override + public CloseWebSocketFrame duplicate() { + return new CloseWebSocketFrame(isFinalFragment(), rsv(), content().duplicate()); + } + @Override public CloseWebSocketFrame retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java index 4330a9f922..9d590a5d02 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/ContinuationWebSocketFrame.java @@ -124,6 +124,11 @@ public class ContinuationWebSocketFrame extends WebSocketFrame { return new ContinuationWebSocketFrame(isFinalFragment(), rsv(), content().copy(), aggregatedText()); } + @Override + public ContinuationWebSocketFrame duplicate() { + return new ContinuationWebSocketFrame(isFinalFragment(), rsv(), content().duplicate(), aggregatedText()); + } + @Override public ContinuationWebSocketFrame retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PingWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PingWebSocketFrame.java index 3958c18a1b..bc4e6b8d4d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PingWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PingWebSocketFrame.java @@ -59,6 +59,11 @@ public class PingWebSocketFrame extends WebSocketFrame { return new PingWebSocketFrame(isFinalFragment(), rsv(), content().copy()); } + @Override + public PingWebSocketFrame duplicate() { + return new PingWebSocketFrame(isFinalFragment(), rsv(), content().duplicate()); + } + @Override public PingWebSocketFrame retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PongWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PongWebSocketFrame.java index 2dfd6f053a..0324a3c098 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PongWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/PongWebSocketFrame.java @@ -59,6 +59,11 @@ public class PongWebSocketFrame extends WebSocketFrame { return new PongWebSocketFrame(isFinalFragment(), rsv(), content().copy()); } + @Override + public PongWebSocketFrame duplicate() { + return new PongWebSocketFrame(isFinalFragment(), rsv(), content().duplicate()); + } + @Override public PongWebSocketFrame retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/TextWebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/TextWebSocketFrame.java index 5963d2b73c..dfa311f17c 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/TextWebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/TextWebSocketFrame.java @@ -99,6 +99,11 @@ public class TextWebSocketFrame extends WebSocketFrame { return new TextWebSocketFrame(isFinalFragment(), rsv(), content().copy()); } + @Override + public TextWebSocketFrame duplicate() { + return new TextWebSocketFrame(isFinalFragment(), rsv(), content().duplicate()); + } + @Override public TextWebSocketFrame retain() { super.retain(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrame.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrame.java index 63c6a5a851..f132407c44 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrame.java @@ -62,6 +62,9 @@ public abstract class WebSocketFrame extends DefaultByteBufHolder { @Override public abstract WebSocketFrame copy(); + @Override + public abstract WebSocketFrame duplicate(); + @Override public String toString() { return getClass().getSimpleName() + "(data: " + content().toString() + ')'; diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyDataFrame.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyDataFrame.java index dc1ec159e4..4a5b32a262 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyDataFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/DefaultSpdyDataFrame.java @@ -85,6 +85,13 @@ public class DefaultSpdyDataFrame extends DefaultSpdyStreamFrame implements Spdy return frame; } + @Override + public SpdyDataFrame duplicate() { + SpdyDataFrame frame = new DefaultSpdyDataFrame(getStreamId(), content().duplicate()); + frame.setLast(isLast()); + return frame; + } + @Override public int refCnt() { return data.refCnt(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyDataFrame.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyDataFrame.java index ea6d5e6b19..bb561589f7 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyDataFrame.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyDataFrame.java @@ -42,6 +42,9 @@ public interface SpdyDataFrame extends ByteBufHolder, SpdyStreamFrame { @Override SpdyDataFrame copy(); + @Override + SpdyDataFrame duplicate(); + @Override SpdyDataFrame retain(); diff --git a/codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java b/codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java index 0334ba612d..34844614ee 100644 --- a/codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java +++ b/codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java @@ -82,6 +82,11 @@ public class AbstractMemoryHttpDataTest { throw new UnsupportedOperationException("Should never be called."); } + @Override + public HttpData duplicate() { + throw new UnsupportedOperationException("Should never be called."); + } + @Override public int compareTo(InterfaceHttpData o) { throw new UnsupportedOperationException("Should never be called."); diff --git a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpMessage.java b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpMessage.java index 84b2c03504..6938f3bb3d 100644 --- a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpMessage.java +++ b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpMessage.java @@ -135,6 +135,15 @@ public final class SctpMessage extends DefaultByteBufHolder { } } + @Override + public SctpMessage duplicate() { + if (msgInfo == null) { + return new SctpMessage(protocolIdentifier, streamIdentifier, content().duplicate()); + } else { + return new SctpMessage(msgInfo, content().copy()); + } + } + @Override public SctpMessage retain() { super.retain(); diff --git a/transport/src/main/java/io/netty/channel/group/DefaultChannelGroup.java b/transport/src/main/java/io/netty/channel/group/DefaultChannelGroup.java index 8e83e8bca4..d211d6d985 100644 --- a/transport/src/main/java/io/netty/channel/group/DefaultChannelGroup.java +++ b/transport/src/main/java/io/netty/channel/group/DefaultChannelGroup.java @@ -251,7 +251,7 @@ public class DefaultChannelGroup extends AbstractSet implements Channel if (message instanceof ByteBuf) { return ((ByteBuf) message).duplicate().retain(); } else if (message instanceof ByteBufHolder) { - return ((ByteBufHolder) message).copy(); + return ((ByteBufHolder) message).duplicate().retain(); } else { return ReferenceCountUtil.retain(message); } diff --git a/transport/src/main/java/io/netty/channel/socket/DatagramPacket.java b/transport/src/main/java/io/netty/channel/socket/DatagramPacket.java index fd8914a3dd..e1239dde3d 100644 --- a/transport/src/main/java/io/netty/channel/socket/DatagramPacket.java +++ b/transport/src/main/java/io/netty/channel/socket/DatagramPacket.java @@ -47,6 +47,11 @@ public final class DatagramPacket return new DatagramPacket(content().copy(), recipient(), sender()); } + @Override + public DatagramPacket duplicate() { + return new DatagramPacket(content().duplicate(), recipient(), sender()); + } + @Override public DatagramPacket retain() { super.retain();