[#539] Potential direct memory leak in HttpContentEn/Decoder
This commit is contained in:
parent
bf74b16774
commit
a93ada2031
@ -20,6 +20,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.LifeCycleAwareChannelHandler;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||
import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
|
||||
@ -43,7 +44,8 @@ import org.jboss.netty.handler.codec.embedder.DecoderEmbedder;
|
||||
* so that this handler can intercept HTTP requests after {@link HttpMessageDecoder}
|
||||
* converts {@link ChannelBuffer}s into HTTP requests.
|
||||
*/
|
||||
public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler {
|
||||
public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler
|
||||
implements LifeCycleAwareChannelHandler {
|
||||
|
||||
private DecoderEmbedder<ChannelBuffer> decoder;
|
||||
|
||||
@ -183,4 +185,20 @@ public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler {
|
||||
decoder = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void beforeAdd(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void afterAdd(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void beforeRemove(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void afterRemove(ChannelHandlerContext ctx) throws Exception {
|
||||
finishDecode();
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
|
||||
import org.jboss.netty.channel.ChannelHandlerContext;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.channel.Channels;
|
||||
import org.jboss.netty.channel.LifeCycleAwareChannelHandler;
|
||||
import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelHandler;
|
||||
import org.jboss.netty.handler.codec.embedder.EncoderEmbedder;
|
||||
@ -48,7 +49,8 @@ import org.jboss.netty.handler.codec.embedder.EncoderEmbedder;
|
||||
* so that this handler can intercept HTTP responses before {@link HttpMessageEncoder}
|
||||
* converts them into {@link ChannelBuffer}s.
|
||||
*/
|
||||
public abstract class HttpContentEncoder extends SimpleChannelHandler {
|
||||
public abstract class HttpContentEncoder extends SimpleChannelHandler
|
||||
implements LifeCycleAwareChannelHandler {
|
||||
|
||||
private final Queue<String> acceptEncodingQueue = new ConcurrentLinkedQueue<String>();
|
||||
private volatile EncoderEmbedder<ChannelBuffer> encoder;
|
||||
@ -215,4 +217,20 @@ public abstract class HttpContentEncoder extends SimpleChannelHandler {
|
||||
encoder = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void beforeAdd(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void afterAdd(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void beforeRemove(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
public void afterRemove(ChannelHandlerContext ctx) throws Exception {
|
||||
finishEncode();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user