public abstract class AbstractMemcacheObjectAggregator extends MessageToMessageDecoder<MemcacheObject>
A 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.
ChannelPipelinep = …; … 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, decodechannelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredisSharableprotected FullMemcacheMessage currentMessage
Contains the current message that gets aggregated.
protected ChannelHandlerContext ctx
Holds the current channel handler context if set.
public static final int DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS
protected AbstractMemcacheObjectAggregator(int maxContentLength)
public final int getMaxCumulationBufferComponents()
Returns the maximum number of components in the cumulation buffer. If the number of the components in the cumulation buffer exceeds this value, the components of the cumulation buffer are consolidated into a single component, involving memory copies. The default value of this property is DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS.
public final void setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
Sets the maximum number of components in the cumulation buffer. If the number of the components in the cumulation buffer exceeds this value, the components of the cumulation buffer are consolidated into a single component, involving memory copies. The default value of this property is DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS and its minimum allowed value is 2.
public int getMaxContentLength()
public void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive in interface ChannelInboundHandlerchannelInactive in class ChannelInboundHandlerAdapterExceptionpublic void handlerAdded(ChannelHandlerContext ctx) throws Exception
handlerAdded in interface ChannelHandlerhandlerAdded in class ChannelHandlerAdapterExceptionpublic void handlerRemoved(ChannelHandlerContext ctx) throws Exception
handlerRemoved in interface ChannelHandlerhandlerRemoved in class ChannelHandlerAdapterExceptionCopyright © 2016 Couchbase, Inc.. All rights reserved.