mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-05 18:22:43 +00:00
8156824: com.sun.jndi.ldap.pool.PoolCleaner should clear its context class loader
Reviewed-by: alanb, dfuchs
This commit is contained in:
parent
2ebc9d3c1f
commit
bb50284487
@ -39,6 +39,7 @@ import java.security.PrivilegedAction;
|
||||
|
||||
import com.sun.jndi.ldap.pool.PoolCleaner;
|
||||
import com.sun.jndi.ldap.pool.Pool;
|
||||
import jdk.internal.misc.InnocuousThread;
|
||||
|
||||
/**
|
||||
* Contains utilities for managing connection pools of LdapClient.
|
||||
@ -163,7 +164,17 @@ public final class LdapPoolManager {
|
||||
|
||||
if (idleTimeout > 0) {
|
||||
// Create cleaner to expire idle connections
|
||||
new PoolCleaner(idleTimeout, pools).start();
|
||||
PrivilegedAction<Void> pa = new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
Thread t = InnocuousThread.newSystemThread(
|
||||
"LDAP PoolCleaner",
|
||||
new PoolCleaner(idleTimeout, pools));
|
||||
assert t.getContextClassLoader() == null;
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
return null;
|
||||
}};
|
||||
AccessController.doPrivileged(pa);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
|
||||
@ -30,7 +30,7 @@ package com.sun.jndi.ldap.pool;
|
||||
*
|
||||
* @author Rosanna Lee
|
||||
*/
|
||||
final public class PoolCleaner extends Thread {
|
||||
final public class PoolCleaner implements Runnable {
|
||||
final private Pool[] pools;
|
||||
final private long period;
|
||||
|
||||
@ -42,9 +42,9 @@ final public class PoolCleaner extends Thread {
|
||||
super();
|
||||
this.period = period;
|
||||
this.pools = pools.clone();
|
||||
setDaemon(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long threshold;
|
||||
while (true) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user