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;
|
package sun.net.dns;
|
||||||
|
|
||||||
|
import jdk.internal.misc.InnocuousThread;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -37,7 +39,7 @@ public final class ResolverConfigurationImpl
|
||||||
extends ResolverConfiguration
|
extends ResolverConfiguration
|
||||||
{
|
{
|
||||||
// Lock held whilst loading configuration or checking
|
// Lock held whilst loading configuration or checking
|
||||||
private static Object lock = new Object();
|
private static final Object lock = new Object();
|
||||||
|
|
||||||
// Resolver options
|
// Resolver options
|
||||||
private final Options opts;
|
private final Options opts;
|
||||||
|
@ -169,7 +171,8 @@ public final class ResolverConfigurationImpl
|
||||||
|
|
||||||
// --- Address Change Listener
|
// --- Address Change Listener
|
||||||
|
|
||||||
static class AddressChangeListener extends Thread {
|
static class AddressChangeListener implements Runnable {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// wait for configuration to change
|
// wait for configuration to change
|
||||||
|
@ -196,9 +199,11 @@ public final class ResolverConfigurationImpl
|
||||||
init0();
|
init0();
|
||||||
|
|
||||||
// start the address listener thread
|
// start the address listener thread
|
||||||
AddressChangeListener thr = new AddressChangeListener();
|
String name = "Jndi-Dns-address-change-listener";
|
||||||
thr.setDaemon(true);
|
Thread addrChangeListener = InnocuousThread.newSystemThread(name,
|
||||||
thr.start();
|
new AddressChangeListener());
|
||||||
|
addrChangeListener.setDaemon(true);
|
||||||
|
addrChangeListener.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue