Skip to content

Commit 4320774

Browse files
committed
Merge pull request AsyncHttpClient#903 from sschepens/pooled_allocators
Use PooledByteByfAllocator by default
2 parents 782f365 + b00f35f commit 4320774

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

providers/netty4/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import static org.asynchttpclient.util.HttpUtils.isWebSocket;
1919
import static org.asynchttpclient.util.MiscUtils.buildStaticIOException;
2020
import io.netty.bootstrap.Bootstrap;
21+
import io.netty.buffer.PooledByteBufAllocator;
2122
import io.netty.channel.Channel;
2223
import io.netty.channel.ChannelInitializer;
2324
import io.netty.channel.ChannelOption;
@@ -180,6 +181,12 @@ public Semaphore apply(Object partitionKey) {
180181
webSocketBootstrap = new Bootstrap().channel(socketChannelClass).group(eventLoopGroup);
181182
secureWebSocketBootstrap = new Bootstrap().channel(socketChannelClass).group(eventLoopGroup);
182183

184+
// default to PooledByteBufAllocator
185+
plainBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
186+
secureBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
187+
webSocketBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
188+
secureWebSocketBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
189+
183190
if (config.getConnectTimeout() > 0)
184191
nettyConfig.addChannelOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectTimeout());
185192
for (Entry<ChannelOption<Object>, Object> entry : nettyConfig.propertiesSet()) {

0 commit comments

Comments
 (0)