Commit 4681610
committed
ConnectionConfig: Add idleTimeout
Connection TTL can be effected either in bulk by calling
`connMgr.closeExpired()` or at connection reuse time by configuring a
`timeToLive` on the `ConnectionConfig`. Strangely, idle timeouts can
only be effected in bulk via `connMgr.closeIdle()`, or with an
`IdleConnectionEvictor`; they have no corresponding `ConnectionConfig`
setting. This change resolves this inconsistency. The result is that
idle timeouts are much easier to configure and enforce: they don't
require spinning up a background thread that periodically locks the
entire conn pool and closes idle connections; there is no longer the
possibility of reusing a connection after it hits its intended idle
timeout; and it doesn't matter whether the connection pool is shared.1 parent 665325c commit 4681610
File tree
3 files changed
+59
-1
lines changed- httpclient5/src/main/java/org/apache/hc/client5/http
- config
- impl
- io
- nio
3 files changed
+59
-1
lines changedLines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| |||
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
| 122 | + | |
112 | 123 | | |
113 | 124 | | |
114 | 125 | | |
| |||
131 | 142 | | |
132 | 143 | | |
133 | 144 | | |
| 145 | + | |
134 | 146 | | |
135 | 147 | | |
136 | 148 | | |
| |||
194 | 206 | | |
195 | 207 | | |
196 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
197 | 238 | | |
198 | 239 | | |
199 | 240 | | |
| |||
244 | 285 | | |
245 | 286 | | |
246 | 287 | | |
| 288 | + | |
247 | 289 | | |
248 | 290 | | |
249 | 291 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
394 | 402 | | |
395 | 403 | | |
396 | 404 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
303 | 311 | | |
304 | 312 | | |
305 | 313 | | |
| |||
0 commit comments