Commit 46595e2
Peter Svensson
use daemon threads to allow shut down of application
To exit normally all non-daemon threads of the java process are supposed
to have stopped. TcpClientSession creates an static class member
EventLoopGroup which in turn instantiates worker threads. These are
changed to daemon threads to not get in the way of the shutdown. This
is similar to the default in Netty 5.
To ensure work is finishd the Runtime shutdown event is hooked to
initiate a time-limited graceful shutdown of the event loops. Normally
an application should shut down communication before the process
shutdown is inititated.1 parent bfb6430 commit 46595e2
File tree
2 files changed
+24
-6
lines changed- src/main/java/com/github/steveice10/packetlib/tcp
2 files changed
+24
-6
lines changedLines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
295 | 298 | | |
296 | 299 | | |
297 | 300 | | |
298 | | - | |
| 301 | + | |
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
303 | | - | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
307 | 310 | | |
308 | | - | |
| 311 | + | |
309 | 312 | | |
310 | 313 | | |
311 | 314 | | |
312 | 315 | | |
313 | | - | |
| 316 | + | |
314 | 317 | | |
315 | 318 | | |
316 | 319 | | |
317 | 320 | | |
318 | 321 | | |
319 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
320 | 333 | | |
321 | 334 | | |
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
296 | 298 | | |
297 | 299 | | |
298 | 300 | | |
299 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
300 | 305 | | |
301 | 306 | | |
302 | 307 | | |
| |||
0 commit comments