mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8287104: AddressChangeListener thread inherits CCL and can cause memory leak for webapp-servers
Reviewed-by: aefimov, dfuchs
This commit is contained in:
parent
796494d0fe
commit
81d7eafd91
1 changed files with 10 additions and 5 deletions
|
@ -25,6 +25,8 @@
|
|||
|
||||
package sun.net.dns;
|
||||
|
||||
import jdk.internal.misc.InnocuousThread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -37,7 +39,7 @@ public final class ResolverConfigurationImpl
|
|||
extends ResolverConfiguration
|
||||
{
|
||||
// Lock held whilst loading configuration or checking
|
||||
private static Object lock = new Object();
|
||||
private static final Object lock = new Object();
|
||||
|
||||
// Resolver options
|
||||
private final Options opts;
|
||||
|
@ -169,7 +171,8 @@ public final class ResolverConfigurationImpl
|
|||
|
||||
// --- Address Change Listener
|
||||
|
||||
static class AddressChangeListener extends Thread {
|
||||
static class AddressChangeListener implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
for (;;) {
|
||||
// wait for configuration to change
|
||||
|
@ -196,9 +199,11 @@ public final class ResolverConfigurationImpl
|
|||
init0();
|
||||
|
||||
// start the address listener thread
|
||||
AddressChangeListener thr = new AddressChangeListener();
|
||||
thr.setDaemon(true);
|
||||
thr.start();
|
||||
String name = "Jndi-Dns-address-change-listener";
|
||||
Thread addrChangeListener = InnocuousThread.newSystemThread(name,
|
||||
new AddressChangeListener());
|
||||
addrChangeListener.setDaemon(true);
|
||||
addrChangeListener.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue