public abstract class AbstractMemcacheObjectAggregator extends MessageToMessageDecoder<MemcacheObject>
ChannelHandler that aggregates an MemcacheMessage
and its following MemcacheContents into a single MemcacheMessage with
no following MemcacheContents. 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:
ChannelPipelinep = ...; ... p.addLast("decoder", newBinaryMemcacheRequestDecoder()); p.addLast("aggregator", newBinaryMemcacheObjectAggregator(1048576) ); ... p.addLast("encoder", newBinaryMemcacheResponseEncoder()); p.addLast("handler", new YourMemcacheRequestHandler());
ChannelHandler.Sharable, ChannelHandler.Skip| 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)
Calls
ChannelHandlerContext.fireChannelInactive() to forward
to the next ChannelHandler in the ChannelPipeline. |
int |
getMaxContentLength() |
int |
getMaxCumulationBufferComponents()
Returns the maximum number of components in the cumulation buffer.
|
void |
handlerAdded(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
void |
handlerRemoved(ChannelHandlerContext ctx)
Do nothing by default, sub-classes may override this method.
|
void |
setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
Sets the maximum number of components in the cumulation buffer.
|
acceptInboundMessage, channelRead, decodebind, channelActive, channelReadComplete, channelRegistered, channelWritabilityChanged, close, connect, disconnect, exceptionCaught, flush, isSharable, read, userEventTriggered, writeprotected 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
ChannelHandlerAdapterChannelHandlerContext.fireChannelInactive() to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelInactive in interface ChannelHandlerchannelInactive in class ChannelHandlerAdapterExceptionpublic void handlerAdded(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerAdded in interface ChannelHandlerhandlerAdded in class ChannelHandlerAdapterExceptionpublic void handlerRemoved(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerRemoved in interface ChannelHandlerhandlerRemoved in class ChannelHandlerAdapterExceptionCopyright © 2008–2013 The Netty Project. All rights reserved.