We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 865240c commit 34ba40eCopy full SHA for 34ba40e
1 file changed
src/main/java/org/xbill/DNS/NioClient.java
@@ -101,10 +101,14 @@ private static void close(boolean fromHook) {
101
}
102
103
if (!fromHook) {
104
- try {
105
- Runtime.getRuntime().removeShutdownHook(closeThread);
106
- } catch (Exception ex) {
107
- log.warn("Failed to remove shutdown hook, ignoring and continuing close");
+ synchronized (NIO_CLIENT_LOCK) {
+ if (closeThread != null) {
+ try {
+ Runtime.getRuntime().removeShutdownHook(closeThread);
108
+ } catch (Exception ex) {
109
+ log.warn("Failed to remove shutdown hook, ignoring and continuing close", ex);
110
+ }
111
112
113
114
0 commit comments