|
16 | 16 | package org.asynchttpclient;
|
17 | 17 |
|
18 | 18 | import static org.asynchttpclient.config.AsyncHttpClientConfigDefaults.*;
|
| 19 | +import io.netty.buffer.ByteBufAllocator; |
19 | 20 | import io.netty.channel.ChannelOption;
|
20 | 21 | import io.netty.channel.EventLoopGroup;
|
21 | 22 | import io.netty.handler.ssl.SslContext;
|
@@ -119,7 +120,7 @@ public class DefaultAsyncHttpClientConfig implements AsyncHttpClientConfig {
|
119 | 120 | private final Map<ChannelOption<Object>, Object> channelOptions;
|
120 | 121 | private final EventLoopGroup eventLoopGroup;
|
121 | 122 | private final boolean useNativeTransport;
|
122 |
| - private final boolean usePooledMemory; |
| 123 | + private final ByteBufAllocator allocator; |
123 | 124 | private final boolean tcpNoDelay;
|
124 | 125 | private final boolean soReuseAddress;
|
125 | 126 | private final int soLinger;
|
@@ -197,7 +198,7 @@ private DefaultAsyncHttpClientConfig(//
|
197 | 198 | Map<ChannelOption<Object>, Object> channelOptions,//
|
198 | 199 | EventLoopGroup eventLoopGroup,//
|
199 | 200 | boolean useNativeTransport,//
|
200 |
| - boolean usePooledMemory,// |
| 201 | + ByteBufAllocator allocator,// |
201 | 202 | Timer nettyTimer,//
|
202 | 203 | ThreadFactory threadFactory,//
|
203 | 204 | AdditionalChannelInitializer httpAdditionalChannelInitializer,//
|
@@ -269,7 +270,7 @@ private DefaultAsyncHttpClientConfig(//
|
269 | 270 | this.channelOptions = channelOptions;
|
270 | 271 | this.eventLoopGroup = eventLoopGroup;
|
271 | 272 | this.useNativeTransport = useNativeTransport;
|
272 |
| - this.usePooledMemory = usePooledMemory; |
| 273 | + this.allocator = allocator; |
273 | 274 | this.nettyTimer = nettyTimer;
|
274 | 275 | this.threadFactory = threadFactory;
|
275 | 276 | this.httpAdditionalChannelInitializer = httpAdditionalChannelInitializer;
|
@@ -551,8 +552,8 @@ public boolean isUseNativeTransport() {
|
551 | 552 | }
|
552 | 553 |
|
553 | 554 | @Override
|
554 |
| - public boolean isUsePooledMemory() { |
555 |
| - return usePooledMemory; |
| 555 | + public ByteBufAllocator getAllocator() { |
| 556 | + return allocator; |
556 | 557 | }
|
557 | 558 |
|
558 | 559 | @Override
|
@@ -650,7 +651,7 @@ public static class Builder {
|
650 | 651 | private int webSocketMaxBufferSize = defaultWebSocketMaxBufferSize();
|
651 | 652 | private int webSocketMaxFrameSize = defaultWebSocketMaxFrameSize();
|
652 | 653 | private boolean useNativeTransport = defaultUseNativeTransport();
|
653 |
| - private boolean usePooledMemory = defaultUsePooledMemory(); |
| 654 | + private ByteBufAllocator allocator; |
654 | 655 | private Map<ChannelOption<Object>, Object> channelOptions = new HashMap<>();
|
655 | 656 | private EventLoopGroup eventLoopGroup;
|
656 | 657 | private Timer nettyTimer;
|
@@ -725,7 +726,7 @@ public Builder(AsyncHttpClientConfig config) {
|
725 | 726 | channelOptions.putAll(config.getChannelOptions());
|
726 | 727 | eventLoopGroup = config.getEventLoopGroup();
|
727 | 728 | useNativeTransport = config.isUseNativeTransport();
|
728 |
| - usePooledMemory = config.isUsePooledMemory(); |
| 729 | + allocator = config.getAllocator(); |
729 | 730 | nettyTimer = config.getNettyTimer();
|
730 | 731 | threadFactory = config.getThreadFactory();
|
731 | 732 | httpAdditionalChannelInitializer = config.getHttpAdditionalChannelInitializer();
|
@@ -1035,8 +1036,8 @@ public Builder setUseNativeTransport(boolean useNativeTransport) {
|
1035 | 1036 | return this;
|
1036 | 1037 | }
|
1037 | 1038 |
|
1038 |
| - public Builder setUsePooledMemory(boolean usePooledMemory) { |
1039 |
| - this.usePooledMemory = usePooledMemory; |
| 1039 | + public Builder setAllocator(ByteBufAllocator allocator) { |
| 1040 | + this.allocator = allocator; |
1040 | 1041 | return this;
|
1041 | 1042 | }
|
1042 | 1043 |
|
@@ -1133,7 +1134,7 @@ public DefaultAsyncHttpClientConfig build() {
|
1133 | 1134 | channelOptions.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(channelOptions),//
|
1134 | 1135 | eventLoopGroup, //
|
1135 | 1136 | useNativeTransport, //
|
1136 |
| - usePooledMemory, // |
| 1137 | + allocator, // |
1137 | 1138 | nettyTimer, //
|
1138 | 1139 | threadFactory, //
|
1139 | 1140 | httpAdditionalChannelInitializer, //
|
|
0 commit comments