public abstract class AbstractMemcacheObjectAggregator extends MessageToMessageDecoder<MemcacheObject>
ChannelHandler
that aggregates an MemcacheMessage
and its following MemcacheContent
s into a single MemcacheMessage
with
no following MemcacheContent
s. It is useful when you don't want to take
care of memcache messages where the content comes along in chunks. Insert this
handler after a AbstractMemcacheObjectDecoder in the ChannelPipeline
.
For example, here for the binary protocol:
ChannelPipeline
p = ...; ... p.addLast("decoder", newBinaryMemcacheRequestDecoder
()); p.addLast("aggregator", newBinaryMemcacheObjectAggregator
(1048576) ); ... p.addLast("encoder", newBinaryMemcacheResponseEncoder
()); p.addLast("handler", new YourMemcacheRequestHandler());
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
protected ChannelHandlerContext |
ctx
Holds the current channel handler context if set.
|
protected FullMemcacheMessage |
currentMessage
Contains the current message that gets aggregated.
|
static int |
DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS |
Modifier | Constructor and Description |
---|---|
protected |
AbstractMemcacheObjectAggregator(int maxContentLength) |
Modifier and Type | Method and Description |
---|---|
void |
channelInactive(ChannelHandlerContext ctx) |
int |
getMaxContentLength() |
int |
getMaxCumulationBufferComponents()
Returns the maximum number of components in the cumulation buffer.
|
void |
handlerAdded(ChannelHandlerContext ctx) |
void |
handlerRemoved(ChannelHandlerContext ctx) |
void |
setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
Sets the maximum number of components in the cumulation buffer.
|
acceptInboundMessage, channelRead, decode
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, isSharable
protected FullMemcacheMessage currentMessage
protected ChannelHandlerContext ctx
public static final int DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
protected AbstractMemcacheObjectAggregator(int maxContentLength)
public final int getMaxCumulationBufferComponents()
DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
.public final void setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
and its minimum allowed value is 2
.public int getMaxContentLength()
public void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive
in interface ChannelInboundHandler
channelInactive
in class ChannelInboundHandlerAdapter
Exception
public void handlerAdded(ChannelHandlerContext ctx) throws Exception
handlerAdded
in interface ChannelHandler
handlerAdded
in class ChannelHandlerAdapter
Exception
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception
handlerRemoved
in interface ChannelHandler
handlerRemoved
in class ChannelHandlerAdapter
Exception
Copyright © 2021 Couchbase, Inc.. All rights reserved.