Skip to content

Commit b00f35f

Browse files
committed
default to using pooled allocators
1 parent 281cd4e commit b00f35f

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;
@@ -175,6 +176,12 @@ public Semaphore apply(Object partitionKey) {
175176
webSocketBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
176177
secureWebSocketBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
177178

179+
// default to PooledByteBufAllocator
180+
plainBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
181+
secureBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
182+
webSocketBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
183+
secureWebSocketBootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
184+
178185
if (config.getConnectTimeout() > 0)
179186
nettyConfig.addChannelOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectTimeout());
180187
for (Entry<ChannelOption<Object>, Object> entry : nettyConfig.propertiesSet()) {

0 commit comments

Comments
 (0)