Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit 7131315

Browse files
committed
Optionally disable ShutdownHook in NioClient
dnsjava#358
1 parent d445fe8 commit 7131315

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎README.adoc‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ Do NOT use it.
115115
|1000
116116
|700
117117

118+
.2+|dnsjava.nio.register_shutdown_hook
119+
3+|Register Shutdown Hook for automatic termination of NIO.
120+
If disabled, the nio selector thread will not automatically clean up on JVM termination.
121+
|Boolean
122+
|True
123+
|False
124+
118125
.2+|dnsjava.harden_unknown_additional
119126
3+|Harden against unknown records in the authority section and additional section.
120127
If disabled, such records are copied from the upstream and presented to the client together with the answer.

‎src/main/java/org/xbill/DNS/NioClient.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* <dl>
2626
* <dt>dnsjava.nio.selector_timeout
2727
* <dd>Set selector timeout in milliseconds. Default/Max 1000, Min 1.
28+
* <dt>dnsjava.nio.register_shutdown_hook
29+
* <dd>Register Shutdown Hook termination of NIO. Default True.
2830
* </dl>
2931
*
3032
* @since 3.4
@@ -60,7 +62,9 @@ static Selector selector() throws IOException {
6062
selectorThread.start();
6163
closeThread = new Thread(() -> close(true));
6264
closeThread.setName("dnsjava NIO shutdown hook");
63-
Runtime.getRuntime().addShutdownHook(closeThread);
65+
if (Boolean.parseBoolean(System.getProperty("dnsjava.nio.register_shutdown_hook", "true"))) {
66+
Runtime.getRuntime().addShutdownHook(closeThread);
67+
}
6468
}
6569
}
6670
}

0 commit comments

Comments
 (0)