Skip to content

Commit cd442f6

Browse files
committed
Move ConnectionSemaphore creation to NettyRequestSender constructor
1 parent def566d commit cd442f6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

client/src/main/java/org/asynchttpclient/DefaultAsyncHttpClient.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
package org.asynchttpclient;
1818

1919
import static org.asynchttpclient.util.Assertions.assertNotNull;
20-
import io.netty.channel.EventLoopGroup;
21-
import io.netty.util.HashedWheelTimer;
22-
import io.netty.util.Timer;
2320

2421
import java.util.concurrent.atomic.AtomicBoolean;
2522
import java.util.function.Predicate;
@@ -30,11 +27,14 @@
3027
import org.asynchttpclient.filter.RequestFilter;
3128
import org.asynchttpclient.handler.resumable.ResumableAsyncHandler;
3229
import org.asynchttpclient.netty.channel.ChannelManager;
33-
import org.asynchttpclient.netty.channel.ConnectionSemaphore;
3430
import org.asynchttpclient.netty.request.NettyRequestSender;
3531
import org.slf4j.Logger;
3632
import org.slf4j.LoggerFactory;
3733

34+
import io.netty.channel.EventLoopGroup;
35+
import io.netty.util.HashedWheelTimer;
36+
import io.netty.util.Timer;
37+
3838
/**
3939
* Default and threadsafe implementation of {@link AsyncHttpClient}.
4040
*/
@@ -83,8 +83,7 @@ public DefaultAsyncHttpClient(AsyncHttpClientConfig config) {
8383
nettyTimer = allowStopNettyTimer ? newNettyTimer() : config.getNettyTimer();
8484

8585
channelManager = new ChannelManager(config, nettyTimer);
86-
ConnectionSemaphore connectionSemaphore = ConnectionSemaphore.newConnectionSemaphore(config);
87-
requestSender = new NettyRequestSender(config, channelManager, connectionSemaphore, nettyTimer, new AsyncHttpClientState(closed));
86+
requestSender = new NettyRequestSender(config, channelManager, nettyTimer, new AsyncHttpClientState(closed));
8887
channelManager.configureBootstraps(requestSender);
8988
}
9089

client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ public final class NettyRequestSender {
8484

8585
public NettyRequestSender(AsyncHttpClientConfig config,//
8686
ChannelManager channelManager,//
87-
ConnectionSemaphore connectionSemaphore,//
8887
Timer nettyTimer,//
8988
AsyncHttpClientState clientState) {
9089
this.config = config;
9190
this.channelManager = channelManager;
92-
this.connectionSemaphore = connectionSemaphore;
91+
this.connectionSemaphore = ConnectionSemaphore.newConnectionSemaphore(config);
9392
this.nettyTimer = nettyTimer;
9493
this.clientState = clientState;
9594
requestFactory = new NettyRequestFactory(config);

0 commit comments

Comments
 (0)