Skip to content

Commit

Permalink
Use the pooled allocator for performance reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
Norman Maurer committed Feb 1, 2014
1 parent b52e041 commit 18ef05d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import com.squareup.okhttp.internal.Util;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.SimpleChannelInboundHandler;
Expand Down Expand Up @@ -81,6 +83,7 @@ public class NettyHttpClient implements HttpClient {
EventLoopGroup group = new NioEventLoopGroup();
bootstrap = new Bootstrap();
bootstrap.group(group)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.channel(NioSocketChannel.class)
.handler(channelInitializer);
}
Expand Down

0 comments on commit 18ef05d

Please sign in to comment.