Clearify when you need to call retain()
This commit is contained in:
parent
c6886f9d0e
commit
78c6925921
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package io.netty.handler.codec;
|
||||
|
||||
import io.netty.buffer.ReferenceCounted;
|
||||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
@ -45,6 +46,10 @@ import io.netty.util.internal.TypeParameterMatcher;
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Be aware that you need to call {@link ReferenceCounted#retain()} on messages that are just passed through if they
|
||||
* are of type {@link ReferenceCounted}. This is needed as the {@link MessageToMessageCodec} will call
|
||||
* {@link ReferenceCounted#release()} on encoded / decoded messages.
|
||||
*/
|
||||
public abstract class MessageToMessageCodec<INBOUND_IN, OUTBOUND_IN> extends ChannelDuplexHandler {
|
||||
|
||||
|
@ -16,13 +16,15 @@
|
||||
package io.netty.handler.codec;
|
||||
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
import io.netty.buffer.ReferenceCounted;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.channel.MessageList;
|
||||
import io.netty.util.internal.TypeParameterMatcher;
|
||||
|
||||
/**
|
||||
* {@link ChannelInboundHandlerAdapter} which decodes from one message to an other message
|
||||
* {@link ChannelInboundHandlerAdapter} which decodes from one message to an other message.
|
||||
*
|
||||
*
|
||||
* For example here is an implementation which decodes a {@link String} to an {@link Integer} which represent
|
||||
* the length of the {@link String}.
|
||||
@ -39,6 +41,10 @@ import io.netty.util.internal.TypeParameterMatcher;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Be aware that you need to call {@link ReferenceCounted#retain()} on messages that are just passed through if they
|
||||
* are of type {@link ReferenceCounted}. This is needed as the {@link MessageToMessageDecoder} will call
|
||||
* {@link ReferenceCounted#release()} on decoded messages.
|
||||
*
|
||||
*/
|
||||
public abstract class MessageToMessageDecoder<I> extends ChannelInboundHandlerAdapter {
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
package io.netty.handler.codec;
|
||||
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
import io.netty.buffer.ReferenceCounted;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
@ -39,6 +40,9 @@ import io.netty.util.internal.TypeParameterMatcher;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Be aware that you need to call {@link ReferenceCounted#retain()} on messages that are just passed through if they
|
||||
* are of type {@link ReferenceCounted}. This is needed as the {@link MessageToMessageEncoder} will call
|
||||
* {@link ReferenceCounted#release()} on encoded messages.
|
||||
*/
|
||||
public abstract class MessageToMessageEncoder<I> extends ChannelOutboundHandlerAdapter {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user