Commit e4fc1a1
committed
Fix incorrect channel factory selection for custom EventLoopGroups
`LoopResources.onChannel()` and `onChannelClass()` incorrectly selected channel factories when users provided custom `EventLoopGroups` via `runOn()`. The previous logic only checked if `DefaultLoopNativeDetector.INSTANCE` (the highest-priority available transport) supported the group, falling back to `NIO` otherwise.
This caused issues when, for example, `io_uring` was the default transport but a user explicitly provided an `Epoll` `EventLoopGroup` - the code would incorrectly return `NIO` channel factories instead of `Epoll` ones.
Changes:
- Add forGroup(EventLoopGroup) method to `DefaultLoopNativeDetector` that checks all available transports (`io_uring`, `epoll`, `kqueue`, `nio`) to find the correct channel factory for any given `EventLoopGroup`
- Fix `DefaultLoopNIO.supportGroup()` to properly detect `NIO` event loops using `isCompatible(NioIoHandle.class)`, matching the pattern used by other transports
- Update `onChannel()` and `onChannelClass()` to use `forGroup()` instead of the previous INSTANCE-or-NIO logic
Signed-off-by: Jeff Bahr <[email protected]>1 parent eb23743 commit e4fc1a1
File tree
6 files changed
+404
-30
lines changed- reactor-netty-core
- src
- main
- java17/reactor/netty/resources
- java/reactor/netty/resources
- test/java/reactor/netty/resources
6 files changed
+404
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
205 | 210 | | |
206 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
207 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
208 | 224 | | |
209 | 225 | | |
210 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
211 | 238 | | |
212 | 239 | | |
213 | 240 | | |
| |||
389 | 416 | | |
390 | 417 | | |
391 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
392 | 422 | | |
393 | 423 | | |
394 | 424 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
Lines changed: 48 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
29 | 41 | | |
30 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
31 | 46 | | |
32 | | - | |
33 | | - | |
| 47 | + | |
| 48 | + | |
34 | 49 | | |
35 | | - | |
36 | | - | |
| 50 | + | |
| 51 | + | |
37 | 52 | | |
38 | | - | |
39 | | - | |
| 53 | + | |
| 54 | + | |
40 | 55 | | |
41 | 56 | | |
42 | 57 | | |
43 | 58 | | |
44 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
45 | 86 | | |
Lines changed: 3 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 238 | + | |
244 | 239 | | |
245 | 240 | | |
246 | 241 | | |
| |||
252 | 247 | | |
253 | 248 | | |
254 | 249 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 250 | + | |
261 | 251 | | |
262 | 252 | | |
263 | 253 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
91 | 96 | | |
92 | 97 | | |
0 commit comments