Package io.netty.handler.codec.redis
Class RedisArrayAggregator
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.MessageToMessageDecoder<RedisMessage>
-
- io.netty.handler.codec.redis.RedisArrayAggregator
-
- All Implemented Interfaces:
ChannelHandler,ChannelInboundHandler
@UnstableApi public final class RedisArrayAggregator extends MessageToMessageDecoder<RedisMessage>
AggregatesRedisMessageparts intoArrayRedisMessage. This decoder should be used together withRedisDecoder.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Constructor Description RedisArrayAggregator()Deprecated.UseRedisArrayAggregator(int, int)instead to define a max size of the array to aggregate.RedisArrayAggregator(int maxElements, int maxNestedArrayDepth)Create a new instance that will aggregate anArrayHeaderRedisMessageand its subsequent elements into anArrayRedisMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelInactive(ChannelHandlerContext ctx)CallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline.protected voiddecode(ChannelHandlerContext ctx, RedisMessage msg, java.util.List<java.lang.Object> out)Decode from one message to an other.voidhandlerRemoved(ChannelHandlerContext ctx)Do nothing by default, sub-classes may override this method.-
Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder
acceptInboundMessage, channelRead, channelReadComplete
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded
-
-
-
-
Constructor Detail
-
RedisArrayAggregator
@Deprecated public RedisArrayAggregator()
Deprecated.UseRedisArrayAggregator(int, int)instead to define a max size of the array to aggregate.Create a new instance that will aggregate anArrayHeaderRedisMessageand its subsequent elements into anArrayRedisMessage.This constructor specifies a maximum number of elements of 1.000.000, but this default can be increased with the "io.netty.handler.codec.redis.maxArrayLength" system property.
-
RedisArrayAggregator
public RedisArrayAggregator(int maxElements, int maxNestedArrayDepth)Create a new instance that will aggregate anArrayHeaderRedisMessageand its subsequent elements into anArrayRedisMessage.A
CodecExceptionwill be thrown if the array header specify a length greater than the given number of max elements.- Parameters:
maxElements- The maximum number of elements to aggregate in a single message.maxNestedArrayDepth- the maximum depth of the nested array before an exception will be thrown
-
-
Method Detail
-
decode
protected void decode(ChannelHandlerContext ctx, RedisMessage msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
Description copied from class:MessageToMessageDecoderDecode from one message to an other. This method will be called for each written message that can be handled by this decoder.- Specified by:
decodein classMessageToMessageDecoder<RedisMessage>- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToMessageDecoderbelongs tomsg- the message to decode to an other oneout- theListto which decoded messages should be added- Throws:
java.lang.Exception- is thrown if an error occurs
-
handlerRemoved
public void handlerRemoved(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerRemovedin interfaceChannelHandler- Overrides:
handlerRemovedin classChannelHandlerAdapter- Throws:
java.lang.Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelInactivein interfaceChannelInboundHandler- Overrides:
channelInactivein classChannelInboundHandlerAdapter- Throws:
java.lang.Exception
-
-