mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8190482: InnocuousThread creation should not require the caller to possess enableContextClassLoaderOverride
Reviewed-by: rriggs, mchung
This commit is contained in:
parent
018138a79c
commit
c5c047de47
1 changed files with 18 additions and 6 deletions
|
@ -62,10 +62,16 @@ public final class InnocuousThread extends Thread {
|
|||
* set to the system class loader.
|
||||
*/
|
||||
public static Thread newThread(String name, Runnable target) {
|
||||
return new InnocuousThread(INNOCUOUSTHREADGROUP,
|
||||
target,
|
||||
name,
|
||||
ClassLoader.getSystemClassLoader());
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<Thread>() {
|
||||
@Override
|
||||
public Thread run() {
|
||||
return new InnocuousThread(INNOCUOUSTHREADGROUP,
|
||||
target,
|
||||
name,
|
||||
ClassLoader.getSystemClassLoader());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,8 +86,14 @@ public final class InnocuousThread extends Thread {
|
|||
* Returns a new InnocuousThread with null context class loader.
|
||||
*/
|
||||
public static Thread newSystemThread(String name, Runnable target) {
|
||||
return new InnocuousThread(INNOCUOUSTHREADGROUP,
|
||||
target, name, null);
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<Thread>() {
|
||||
@Override
|
||||
public Thread run() {
|
||||
return new InnocuousThread(INNOCUOUSTHREADGROUP,
|
||||
target, name, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private InnocuousThread(ThreadGroup group, Runnable target, String name, ClassLoader tccl) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue