public abstract class AbstractBinaryMemcacheDecoder<M extends BinaryMemcacheMessage> extends AbstractMemcacheObjectDecoder
Decoder for both BinaryMemcacheRequest
and BinaryMemcacheResponse
.
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_CHUNK_SIZE |
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
Modifier | Constructor and Description |
---|---|
protected |
AbstractBinaryMemcacheDecoder()
Create a new
AbstractBinaryMemcacheDecoder with default settings. |
protected |
AbstractBinaryMemcacheDecoder(int chunkSize)
Create a new
AbstractBinaryMemcacheDecoder with custom settings. |
Modifier and Type | Method and Description |
---|---|
protected abstract M |
buildInvalidMessage()
Helper method to create a upstream message when the incoming parsing did fail.
|
void |
channelInactive(ChannelHandlerContext ctx)
When the channel goes inactive, release all frames to prevent data leaks.
|
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf in,
List<Object> out) |
protected abstract M |
decodeHeader(ByteBuf in)
Decode and return the parsed
BinaryMemcacheMessage . |
protected void |
resetDecoder()
Prepare for next decoding iteration.
|
actualReadableBytes, callDecode, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public static final int DEFAULT_MAX_CHUNK_SIZE
protected AbstractBinaryMemcacheDecoder()
Create a new AbstractBinaryMemcacheDecoder
with default settings.
protected AbstractBinaryMemcacheDecoder(int chunkSize)
Create a new AbstractBinaryMemcacheDecoder
with custom settings.
chunkSize
- the maximum chunk size of the payload.protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
decode
in class ByteToMessageDecoder
Exception
public void channelInactive(ChannelHandlerContext ctx) throws Exception
When the channel goes inactive, release all frames to prevent data leaks.
channelInactive
in interface ChannelInboundHandler
channelInactive
in class ByteToMessageDecoder
ctx
- handler contextException
- if something goes wrong during channel inactive notification.protected void resetDecoder()
Prepare for next decoding iteration.
protected abstract M decodeHeader(ByteBuf in)
Decode and return the parsed BinaryMemcacheMessage
.
in
- the incoming buffer.protected abstract M buildInvalidMessage()
Helper method to create a upstream message when the incoming parsing did fail.
Copyright © 2016 Couchbase, Inc.. All rights reserved.