cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/2] git commit: CXF-5707 Fixed ByteBuf leak issue
Date Wed, 23 Apr 2014 15:13:24 GMT
CXF-5707 Fixed ByteBuf leak issue


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2f3446fe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2f3446fe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2f3446fe

Branch: refs/heads/master
Commit: 2f3446fe69f51156b324e081d5f2cb2ba5275069
Parents: ab8818b
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Apr 23 23:12:00 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Apr 23 23:13:08 2014 +0800

----------------------------------------------------------------------
 .../netty/server/servlet/NettyServletInputStream.java     | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2f3446fe/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
b/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
index 2f34f50..aca389a 100644
--- a/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
+++ b/rt/transports/http-netty/netty-server/src/main/java/org/apache/cxf/transport/http/netty/server/servlet/NettyServletInputStream.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 
 import javax.servlet.ServletInputStream;
 
+import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufInputStream;
 import io.netty.handler.codec.http.HttpContent;
 
@@ -30,9 +31,11 @@ import io.netty.handler.codec.http.HttpContent;
 public class NettyServletInputStream extends ServletInputStream {
 
     private final ByteBufInputStream in;
+    private final ByteBuf byteBuf;
 
     public NettyServletInputStream(HttpContent httpContent) {
-        this.in = new ByteBufInputStream(httpContent.content());
+        this.byteBuf = httpContent.content();
+        this.in = new ByteBufInputStream(byteBuf);
     }
 
     @Override
@@ -50,4 +53,9 @@ public class NettyServletInputStream extends ServletInputStream {
         return this.in.read(buf, offset, len);
     }
     
+    public void close() throws IOException {
+        // we need to release the ByteBufInputStream
+        byteBuf.release();
+    }
+    
 }


Mime
View raw message