public class MetricBatcher extends io.netty.handler.codec.MessageToMessageDecoder<SingleMetric>
SingleMetric objects in a batch of minimumBatchSize
items to reduce backend communication overhead.| Constructor and Description |
|---|
MetricBatcher(String subKey,
int minimumBatchSize)
Create a batcher with the passed batch size
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
SingleMetric msg,
List<Object> out)
Batch up incoming SingleMetric messages.
|
acceptInboundMessage, channelReadchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredhandlerAdded, handlerRemoved, isSharablepublic MetricBatcher(String subKey, int minimumBatchSize)
subKey - Identification of the metrics of this batcherminimumBatchSize - Size of batches. If the number is less than 1, then 1 is used.protected void decode(io.netty.channel.ChannelHandlerContext ctx,
SingleMetric msg,
List<Object> out)
throws Exception
decode in class io.netty.handler.codec.MessageToMessageDecoder<SingleMetric>ctx - the ChannelHandlerContext which this MessageToMessageDecoder belongs tomsg - the SingleMetric to be batched upout - the List to which decoded messages should be added if the batch size is reachedException - is thrown if an error occursCopyright © 2014 Red Hat, Inc.. All rights reserved.