com.wavefront.agent.channel.IncompleteLineDetectingLineBasedFrameDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proxy-test Show documentation
Show all versions of proxy-test Show documentation
Service for batching and relaying metric traffic to Wavefront
package com.wavefront.agent.channel;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.LineBasedFrameDecoder;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nonnull;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.function.Consumer;
/**
* Line-delimited decoder that has the ability of detecting when clients have disconnected while leaving some
* data in the buffer.
*
* @author [email protected]
*/
public class IncompleteLineDetectingLineBasedFrameDecoder extends LineBasedFrameDecoder {
private final Consumer warningMessageConsumer;
IncompleteLineDetectingLineBasedFrameDecoder(@Nonnull Consumer warningMessageConsumer,
int maxLength) {
super(maxLength, true, false);
this.warningMessageConsumer = warningMessageConsumer;
}
@Override
protected void decodeLast(ChannelHandlerContext ctx, ByteBuf in, List