File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
src/main/java/com/ning/http/client/providers/netty/channel/pool Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 29
29
import java .util .ArrayList ;
30
30
import java .util .Collections ;
31
31
import java .util .List ;
32
- import java .util .Map ;
33
32
import java .util .concurrent .ConcurrentHashMap ;
34
33
import java .util .concurrent .ConcurrentLinkedQueue ;
35
34
import java .util .concurrent .TimeUnit ;
@@ -195,21 +194,21 @@ public void run(Timeout timeout) throws Exception {
195
194
int closedCount = 0 ;
196
195
int totalCount = 0 ;
197
196
198
- for (Map .Entry <String , ConcurrentLinkedQueue <IdleChannel >> entry : poolsPerKey .entrySet ()) {
199
-
200
- String poolKey = entry .getKey ();
201
- ConcurrentLinkedQueue <IdleChannel > pool = entry .getValue ();
197
+ for (ConcurrentLinkedQueue <IdleChannel > pool : poolsPerKey .values ()) {
202
198
203
199
// store in intermediate unsynchronized lists to minimize the impact on the ConcurrentLinkedQueue
204
200
if (LOGGER .isDebugEnabled ())
205
201
totalCount += pool .size ();
206
202
207
203
List <IdleChannel > closedChannels = closeChannels (expiredChannels (pool , start ));
208
204
209
- pool .removeAll (closedChannels );
210
- closedCount += closedChannels .size ();
211
- if (pool .isEmpty ())
212
- poolsPerKey .remove (poolKey );
205
+ if (!closedChannels .isEmpty ()) {
206
+ for (IdleChannel closedChannel : closedChannels )
207
+ channelId2Creation .remove (closedChannel .channel .getId ());
208
+
209
+ pool .removeAll (closedChannels );
210
+ closedCount += closedChannels .size ();
211
+ }
213
212
}
214
213
215
214
long duration = millisTime () - start ;
You can’t perform that action at this time.
0 commit comments