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
Aggregates
RedisMessage parts into ArrayRedisMessage. This decoder
should be used together with RedisDecoder.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final Deque<RedisArrayAggregator.AggregateState> private final intprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.RedisArrayAggregator(int maxElements, int maxNestedArrayDepth) Create a new instance that will aggregate anArrayHeaderRedisMessageand its subsequent elements into anArrayRedisMessage. -
Method Summary
Modifier and TypeMethodDescriptionvoidCallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline.protected voiddecode(ChannelHandlerContext ctx, RedisMessage msg, List<Object> out) Decode from one message to an other.private RedisMessagevoidDo nothing by default, sub-classes may override this method.private voidMethods inherited from class MessageToMessageDecoder
acceptInboundMessage, channelRead, channelReadCompleteMethods inherited from class ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
handlerAdded
-
Field Details
-
DEFAULT_MAX_ARRAY_LENGTH
private static final int DEFAULT_MAX_ARRAY_LENGTH -
maxNestedArrayDepth
private final int maxNestedArrayDepth -
depths
-
maxElements
private final int maxElements
-
-
Constructor Details
-
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 Details
-
decode
protected void decode(ChannelHandlerContext ctx, RedisMessage msg, List<Object> out) throws 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:
Exception- is thrown if an error occurs
-
decodeRedisArrayHeader
-
handlerRemoved
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerRemovedin interfaceChannelHandler- Overrides:
handlerRemovedin classChannelHandlerAdapter- Throws:
Exception
-
releaseAndClearDepths
private void releaseAndClearDepths() -
channelInactive
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:
Exception
-
RedisArrayAggregator(int, int)instead to define a max size of the array to aggregate.