|
20 | 20 | import io.netty.handler.codec.http.cookie.Cookie;
|
21 | 21 | import io.netty.util.HashedWheelTimer;
|
22 | 22 | import io.netty.util.Timer;
|
| 23 | +import io.netty.util.concurrent.DefaultThreadFactory; |
23 | 24 | import org.asynchttpclient.channel.ChannelPool;
|
24 | 25 | import org.asynchttpclient.filter.FilterContext;
|
25 | 26 | import org.asynchttpclient.filter.FilterException;
|
|
31 | 32 | import org.slf4j.LoggerFactory;
|
32 | 33 |
|
33 | 34 | import java.util.List;
|
| 35 | +import java.util.concurrent.ThreadFactory; |
34 | 36 | import java.util.concurrent.atomic.AtomicBoolean;
|
35 | 37 | import java.util.function.Predicate;
|
36 | 38 |
|
@@ -82,15 +84,16 @@ public DefaultAsyncHttpClient(AsyncHttpClientConfig config) {
|
82 | 84 | this.config = config;
|
83 | 85 | this.noRequestFilters = config.getRequestFilters().isEmpty();
|
84 | 86 | allowStopNettyTimer = config.getNettyTimer() == null;
|
85 |
| - nettyTimer = allowStopNettyTimer ? newNettyTimer() : config.getNettyTimer(); |
| 87 | + nettyTimer = allowStopNettyTimer ? newNettyTimer(config) : config.getNettyTimer(); |
86 | 88 |
|
87 | 89 | channelManager = new ChannelManager(config, nettyTimer);
|
88 | 90 | requestSender = new NettyRequestSender(config, channelManager, nettyTimer, new AsyncHttpClientState(closed));
|
89 | 91 | channelManager.configureBootstraps(requestSender);
|
90 | 92 | }
|
91 | 93 |
|
92 |
| - private Timer newNettyTimer() { |
93 |
| - HashedWheelTimer timer = new HashedWheelTimer(); |
| 94 | + private Timer newNettyTimer(AsyncHttpClientConfig config) { |
| 95 | + ThreadFactory threadFactory = new DefaultThreadFactory(config.getThreadPoolName() + "-timer"); |
| 96 | + HashedWheelTimer timer = new HashedWheelTimer(threadFactory); |
94 | 97 | timer.start();
|
95 | 98 | return timer;
|
96 | 99 | }
|
|
0 commit comments