8080405: Exception in thread "AWT-EventQueue-1" java.security.AccessControlException
Reviewed-by: prr, chegar, art
This commit is contained in:
parent
561c4e223c
commit
33c5b92bc6
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,6 +48,11 @@ public class ManagedLocalsThread extends Thread {
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public ManagedLocalsThread(ThreadGroup group, Runnable target) {
|
||||
super(group, target);
|
||||
eraseThreadLocals();
|
||||
}
|
||||
|
||||
public ManagedLocalsThread(Runnable target, String name) {
|
||||
super(target, name);
|
||||
eraseThreadLocals();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -383,11 +383,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
this.currentDirectory = currentDirectory;
|
||||
this.fid = fid;
|
||||
String name = "Aqua L&F File Loading Thread";
|
||||
if (System.getSecurityManager() == null) {
|
||||
this.loadThread = new Thread(FilesLoader.this, name);
|
||||
} else {
|
||||
this.loadThread = new ManagedLocalsThread(FilesLoader.this, name);
|
||||
}
|
||||
this.loadThread = new ManagedLocalsThread(this, name);
|
||||
this.loadThread.start();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,7 +42,7 @@ import sun.awt.FontConfiguration;
|
||||
import sun.awt.HeadlessToolkit;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.lwawt.macosx.*;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
public final class CFontManager extends SunFontManager {
|
||||
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
|
||||
@ -213,17 +213,12 @@ public final class CFontManager extends SunFontManager {
|
||||
}
|
||||
};
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
if (System.getSecurityManager() == null) {
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
fileCloser = new Thread(rootTG, fileCloserRunnable);
|
||||
} else {
|
||||
/* InnocuousThread is a member of a correct TG by default */
|
||||
fileCloser = new InnocuousThread(fileCloserRunnable);
|
||||
}
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
fileCloser = new ManagedLocalsThread(rootTG, fileCloserRunnable);
|
||||
fileCloser.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(fileCloser);
|
||||
return null;
|
||||
|
@ -35,7 +35,7 @@ import java.security.*;
|
||||
import java.util.*;
|
||||
|
||||
import sun.awt.*;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.print.*;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
|
||||
@ -77,22 +77,13 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
|
||||
shutdown();
|
||||
waitForRunState(STATE_CLEANUP);
|
||||
};
|
||||
Thread shutdown;
|
||||
if (System.getSecurityManager() == null) {
|
||||
shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
|
||||
} else {
|
||||
shutdown = new InnocuousThread(shutdownRunnable);
|
||||
}
|
||||
Thread shutdown = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
|
||||
shutdown.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(shutdown);
|
||||
|
||||
String name = "AWT-LW";
|
||||
Thread toolkitThread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
toolkitThread = new Thread(ThreadGroupUtils.getRootThreadGroup(), LWToolkit.this, name);
|
||||
} else {
|
||||
toolkitThread = new InnocuousThread(LWToolkit.this, name);
|
||||
}
|
||||
Thread toolkitThread = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), this, name);
|
||||
toolkitThread.setDaemon(true);
|
||||
toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
|
||||
toolkitThread.start();
|
||||
|
@ -181,13 +181,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||
}
|
||||
}
|
||||
};
|
||||
Thread dragThread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
dragThread = new Thread(dragRunnable);
|
||||
} else {
|
||||
dragThread = new ManagedLocalsThread(dragRunnable);
|
||||
}
|
||||
dragThread.start();
|
||||
new ManagedLocalsThread(dragRunnable).start();
|
||||
} catch (Exception e) {
|
||||
final long nativeDragSource = getNativeContext();
|
||||
setNativeContext(0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -120,11 +120,7 @@ class CFileDialog implements FileDialogPeer {
|
||||
if (visible) {
|
||||
// Java2 Dialog class requires peer to run code in a separate thread
|
||||
// and handles keeping the call modal
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(new Task()).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(new Task()).start();
|
||||
}
|
||||
new ManagedLocalsThread(new Task()).start();
|
||||
}
|
||||
// We hide ourself before "show" returns - setVisible(false)
|
||||
// doesn't apply
|
||||
|
@ -59,11 +59,7 @@ public class CPrinterDialogPeer extends LWWindowPeer {
|
||||
printerDialog.setRetVal(printerDialog.showDialog());
|
||||
printerDialog.setVisible(false);
|
||||
};
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(task).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(task).start();
|
||||
}
|
||||
new ManagedLocalsThread(task).start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -736,12 +736,7 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
|
||||
// upcall from native
|
||||
private static void detachPrintLoop(final long target, final long arg) {
|
||||
Runnable task = () -> _safePrintLoop(target, arg);
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(task).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(task).start();
|
||||
}
|
||||
new ManagedLocalsThread(() -> _safePrintLoop(target, arg)).start();
|
||||
}
|
||||
private static native void _safePrintLoop(long target, long arg);
|
||||
|
||||
@ -779,4 +774,4 @@ public final class CPrinterJob extends RasterPrinterJob {
|
||||
(float) (paper.getImageableHeight() / dpi),
|
||||
MediaPrintableArea.INCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,7 @@
|
||||
package com.sun.imageio.stream;
|
||||
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.AccessController;
|
||||
@ -87,17 +87,13 @@ public class StreamCloser {
|
||||
};
|
||||
|
||||
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
if (System.getSecurityManager() == null) {
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup();
|
||||
streamCloser = new Thread(tg, streamCloserRunnable);
|
||||
} else {
|
||||
/* InnocuousThread is a member of a correct TG by default */
|
||||
streamCloser = new InnocuousThread(streamCloserRunnable);
|
||||
}
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup();
|
||||
streamCloser = new ManagedLocalsThread(tg,
|
||||
streamCloserRunnable);
|
||||
/* Set context class loader to null in order to avoid
|
||||
* keeping a strong reference to an application classloader.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2038,11 +2038,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
if (audioRunnable != null) {
|
||||
// Runnable appears to block until completed playing, hence
|
||||
// start up another thread to handle playing.
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(audioRunnable).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(audioRunnable).start();
|
||||
}
|
||||
new ManagedLocalsThread(audioRunnable).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
@ -147,12 +146,7 @@ final class JSSecurityManager {
|
||||
final String threadName,
|
||||
final boolean isDaemon, final int priority,
|
||||
final boolean doStart) {
|
||||
Thread thread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
thread = new Thread(runnable);
|
||||
} else {
|
||||
thread = new ManagedLocalsThread(runnable);
|
||||
}
|
||||
Thread thread = new ManagedLocalsThread(runnable);
|
||||
|
||||
if (threadName != null) {
|
||||
thread.setName(threadName);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,11 +55,7 @@ public final class SoftAudioPusher implements Runnable {
|
||||
if (active)
|
||||
return;
|
||||
active = true;
|
||||
if (System.getSecurityManager() == null) {
|
||||
audiothread = new Thread(this);
|
||||
} else {
|
||||
audiothread = new ManagedLocalsThread(this);
|
||||
}
|
||||
audiothread = new ManagedLocalsThread(this);
|
||||
audiothread.setDaemon(true);
|
||||
audiothread.setPriority(Thread.MAX_PRIORITY);
|
||||
audiothread.start();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -216,11 +216,7 @@ public final class SoftJitterCorrector extends AudioInputStream {
|
||||
}
|
||||
};
|
||||
|
||||
if (System.getSecurityManager() == null) {
|
||||
thread = new Thread(runnable);
|
||||
} else {
|
||||
thread = new ManagedLocalsThread(runnable);
|
||||
}
|
||||
thread = new ManagedLocalsThread(runnable);
|
||||
thread.setDaemon(true);
|
||||
thread.setPriority(Thread.MAX_PRIORITY);
|
||||
thread.start();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -141,11 +141,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
|
||||
pusher = null;
|
||||
jitter_stream = null;
|
||||
sourceDataLine = null;
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(runnable).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(runnable).start();
|
||||
}
|
||||
new ManagedLocalsThread(runnable).start();
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,7 +67,7 @@ class EventDispatchThread extends ManagedLocalsThread {
|
||||
private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>();
|
||||
|
||||
EventDispatchThread(ThreadGroup group, String name, EventQueue queue) {
|
||||
super(group, null, name);
|
||||
super(group, name);
|
||||
setEventQueue(queue);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -137,12 +137,7 @@ public class RenderableImageProducer implements ImageProducer, Runnable {
|
||||
addConsumer(ic);
|
||||
// Need to build a runnable object for the Thread.
|
||||
String name = "RenderableImageProducer Thread";
|
||||
Thread thread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
thread = new Thread(this, name);
|
||||
} else {
|
||||
thread = new ManagedLocalsThread(this);
|
||||
}
|
||||
Thread thread = new ManagedLocalsThread(this, name);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -6402,12 +6402,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
||||
};
|
||||
|
||||
// start printing on another thread
|
||||
Thread th;
|
||||
if (System.getSecurityManager() == null) {
|
||||
th = new Thread(runnable);
|
||||
} else {
|
||||
th = new ManagedLocalsThread(runnable);
|
||||
}
|
||||
Thread th = new ManagedLocalsThread(runnable);
|
||||
th.start();
|
||||
|
||||
printingStatus.showModal(true);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,8 +36,7 @@ import java.util.concurrent.*;
|
||||
import java.util.concurrent.locks.*;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import sun.awt.AppContext;
|
||||
import sun.misc.InnocuousThread;
|
||||
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
/**
|
||||
* Internal class to manage all Timers using one thread.
|
||||
@ -99,12 +98,8 @@ class TimerQueue implements Runnable
|
||||
final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
|
||||
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
|
||||
String name = "TimerQueue";
|
||||
Thread timerThread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
timerThread = new Thread(threadGroup, TimerQueue.this, name);
|
||||
} else {
|
||||
timerThread = new InnocuousThread(threadGroup, TimerQueue.this, name);
|
||||
}
|
||||
Thread timerThread = new ManagedLocalsThread(threadGroup,
|
||||
this, name);
|
||||
timerThread.setDaemon(true);
|
||||
timerThread.setPriority(Thread.NORM_PRIORITY);
|
||||
timerThread.start();
|
||||
|
@ -271,11 +271,7 @@ public class BasicDirectoryModel extends AbstractListModel<Object> implements Pr
|
||||
this.currentDirectory = currentDirectory;
|
||||
this.fid = fid;
|
||||
String name = "Basic L&F File Loading Thread";
|
||||
if (System.getSecurityManager() == null) {
|
||||
this.loadThread = new Thread(this, name);
|
||||
} else {
|
||||
this.loadThread = new ManagedLocalsThread(this, name);
|
||||
}
|
||||
this.loadThread = new ManagedLocalsThread(this, name);
|
||||
this.loadThread.start();
|
||||
}
|
||||
|
||||
|
@ -2365,11 +2365,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
|
||||
runnablePrinting.run();
|
||||
} else {
|
||||
if (isEventDispatchThread) {
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(runnablePrinting).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(runnablePrinting).start();
|
||||
}
|
||||
new ManagedLocalsThread(runnablePrinting).start();
|
||||
printingStatus.showModal(true);
|
||||
} else {
|
||||
printingStatus.showModal(false);
|
||||
|
@ -92,12 +92,7 @@ public class LayoutQueue {
|
||||
}
|
||||
} while (work != null);
|
||||
};
|
||||
String name = "text-layout";
|
||||
if (System.getSecurityManager() == null) {
|
||||
worker = new Thread(workerRunnable, name);
|
||||
} else {
|
||||
worker = new ManagedLocalsThread(workerRunnable, name);
|
||||
}
|
||||
worker = new ManagedLocalsThread(workerRunnable, "text-layout");
|
||||
worker.setPriority(Thread.MIN_PRIORITY);
|
||||
worker.start();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -862,7 +862,7 @@ class AppContextCreator extends ManagedLocalsThread {
|
||||
volatile boolean created = false;
|
||||
|
||||
AppContextCreator(ThreadGroup group) {
|
||||
super(group, null, "AppContextCreator");
|
||||
super(group, "AppContextCreator");
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
/**
|
||||
@ -336,14 +336,9 @@ public final class AWTAutoShutdown implements Runnable {
|
||||
*/
|
||||
private void activateBlockerThread() {
|
||||
AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
|
||||
Thread thread;
|
||||
String name = "AWT-Shutdown";
|
||||
if (System.getSecurityManager() == null) {
|
||||
thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this,
|
||||
name);
|
||||
} else {
|
||||
thread = new InnocuousThread(this, name);
|
||||
}
|
||||
Thread thread = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), this, name);
|
||||
thread.setContextClassLoader(null);
|
||||
thread.setDaemon(false);
|
||||
blockerThread = thread;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,7 +44,7 @@ import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
@ -591,13 +591,9 @@ public final class AppContext {
|
||||
}
|
||||
|
||||
public Thread run() {
|
||||
Thread t;
|
||||
if (System.getSecurityManager() == null) {
|
||||
t = new Thread(appContext.getThreadGroup(), runnable);
|
||||
} else {
|
||||
t = new InnocuousThread(appContext.getThreadGroup(), runnable, "AppContext Disposer");
|
||||
}
|
||||
t.setContextClassLoader(null);
|
||||
Thread t = new ManagedLocalsThread(appContext.getThreadGroup(),
|
||||
runnable, "AppContext Disposer");
|
||||
t.setContextClassLoader(appContext.getContextClassLoader());
|
||||
t.setPriority(Thread.NORM_PRIORITY + 1);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -167,12 +167,7 @@ public abstract class InputMethodManager {
|
||||
// to choose from. Otherwise, just keep the instance.
|
||||
if (imm.hasMultipleInputMethods()) {
|
||||
imm.initialize();
|
||||
Thread immThread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
immThread = new Thread(imm, threadName);
|
||||
} else {
|
||||
immThread = new ManagedLocalsThread(imm, threadName);
|
||||
}
|
||||
Thread immThread = new ManagedLocalsThread(imm, threadName);
|
||||
immThread.setDaemon(true);
|
||||
immThread.setPriority(Thread.NORM_PRIORITY + 1);
|
||||
immThread.start();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,7 +55,7 @@ class ImageFetcher extends ManagedLocalsThread {
|
||||
* Constructor for ImageFetcher -- only called by add() below.
|
||||
*/
|
||||
private ImageFetcher(ThreadGroup threadGroup, int index) {
|
||||
super(threadGroup, null, "Image Fetcher " + index);
|
||||
super(threadGroup, "Image Fetcher " + index);
|
||||
setDaemon(true);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
public class CreatedFontTracker {
|
||||
|
||||
@ -117,17 +117,13 @@ public class CreatedFontTracker {
|
||||
if (t == null) {
|
||||
// Add a shutdown hook to remove the temp file.
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
if (System.getSecurityManager() == null) {
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
t = new Thread(rootTG, TempFileDeletionHook::runHooks);
|
||||
} else {
|
||||
/* InnocuousThread is a member of a correct TG by default */
|
||||
t = new InnocuousThread(TempFileDeletionHook::runHooks);
|
||||
}
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
t = new ManagedLocalsThread(rootTG,
|
||||
TempFileDeletionHook::runHooks);
|
||||
/* Set context class loader to null in order to avoid
|
||||
* keeping a strong reference to an application classloader.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@ import sun.awt.SunToolkit;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.java2d.FontSupport;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
/**
|
||||
@ -2501,12 +2502,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
};
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
if (System.getSecurityManager() == null) {
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
fileCloser = new Thread(rootTG, fileCloserRunnable);
|
||||
} else {
|
||||
fileCloser = new InnocuousThread(fileCloserRunnable);
|
||||
}
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
fileCloser = new ManagedLocalsThread(rootTG,
|
||||
fileCloserRunnable);
|
||||
fileCloser.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(fileCloser);
|
||||
return null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,7 @@
|
||||
package sun.java2d;
|
||||
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
@ -84,13 +84,8 @@ public class Disposer implements Runnable {
|
||||
disposerInstance = new Disposer();
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
String name = "Java2D Disposer";
|
||||
Thread t;
|
||||
if (System.getSecurityManager() == null) {
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
t = new Thread(rootTG, disposerInstance, name);
|
||||
} else {
|
||||
t = new InnocuousThread(disposerInstance, name);
|
||||
}
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
Thread t = new ManagedLocalsThread(rootTG, disposerInstance, name);
|
||||
t.setContextClassLoader(null);
|
||||
t.setDaemon(true);
|
||||
t.setPriority(Thread.MAX_PRIORITY);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,7 +48,7 @@ import java.io.FileNotFoundException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
@ -420,12 +420,8 @@ public abstract class GraphicsPrimitive {
|
||||
public static void setShutdownHook() {
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
TraceReporter t = new TraceReporter();
|
||||
Thread thread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), t);
|
||||
} else {
|
||||
thread = new InnocuousThread(t);
|
||||
}
|
||||
Thread thread = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), t);
|
||||
thread.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
return null;
|
||||
|
@ -29,6 +29,7 @@ import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.java2d.pipe.RenderBuffer;
|
||||
import sun.java2d.pipe.RenderQueue;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
import static sun.java2d.pipe.BufferedOpCodes.*;
|
||||
import java.security.AccessController;
|
||||
@ -161,11 +162,7 @@ public class OGLRenderQueue extends RenderQueue {
|
||||
|
||||
public QueueFlusher() {
|
||||
String name = "Java2D Queue Flusher";
|
||||
if (System.getSecurityManager() == null) {
|
||||
this.thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, name);
|
||||
} else {
|
||||
this.thread = new InnocuousThread(this, name);
|
||||
}
|
||||
thread = new ManagedLocalsThread(ThreadGroupUtils.getRootThreadGroup(), this, name);
|
||||
thread.setDaemon(true);
|
||||
thread.setPriority(Thread.MAX_PRIORITY);
|
||||
thread.start();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -987,12 +987,7 @@ public class PrintJob2D extends PrintJob implements Printable, Runnable {
|
||||
}
|
||||
|
||||
private void startPrinterJobThread() {
|
||||
String name = "printerJobThread";
|
||||
if (System.getSecurityManager() == null) {
|
||||
printerJobThread = new Thread(this, name);
|
||||
} else {
|
||||
printerJobThread = new ManagedLocalsThread(this, name);
|
||||
}
|
||||
printerJobThread = new ManagedLocalsThread(this, "printerJobThread");
|
||||
printerJobThread.start();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,7 @@ class ServiceNotifier extends ManagedLocalsThread {
|
||||
private PrintServiceAttributeSet lastSet;
|
||||
|
||||
ServiceNotifier(PrintService service) {
|
||||
super((Runnable) null, service.getName() + " notifier");
|
||||
super(service.getName() + " notifier");
|
||||
this.service = service;
|
||||
listeners = new Vector<>();
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -116,12 +116,7 @@ final class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
|
||||
showNativeDialog();
|
||||
fd.setVisible(false);
|
||||
};
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(task).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(task).start();
|
||||
}
|
||||
|
||||
new ManagedLocalsThread(task).start();
|
||||
} else {
|
||||
quit();
|
||||
fd.setVisible(false);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,7 +29,6 @@ import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.peer.TrayIconPeer;
|
||||
import sun.awt.*;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
import java.awt.image.*;
|
||||
@ -455,11 +454,7 @@ public abstract class InfoWindow extends Window {
|
||||
final Thread thread;
|
||||
|
||||
Displayer() {
|
||||
if (System.getSecurityManager() == null) {
|
||||
this.thread = new Thread(this);
|
||||
} else {
|
||||
this.thread = new ManagedLocalsThread(this);
|
||||
}
|
||||
this.thread = new ManagedLocalsThread(this);
|
||||
this.thread.setDaemon(true);
|
||||
}
|
||||
|
||||
|
@ -281,12 +281,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
}
|
||||
};
|
||||
String name = "XToolkt-Shutdown-Thread";
|
||||
Thread shutdownThread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
shutdownThread = new Thread(ThreadGroupUtils.getRootThreadGroup(), r, name);
|
||||
} else {
|
||||
shutdownThread = new InnocuousThread(r, name);
|
||||
}
|
||||
Thread shutdownThread = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), r, name);
|
||||
shutdownThread.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(shutdownThread);
|
||||
return null;
|
||||
@ -333,12 +329,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
|
||||
|
||||
toolkitThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
|
||||
String name = "AWT-XAWT";
|
||||
Thread thread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), XToolkit.this, name);
|
||||
} else {
|
||||
thread = new InnocuousThread(XToolkit.this, name);
|
||||
}
|
||||
Thread thread = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), this, name);
|
||||
thread.setContextClassLoader(null);
|
||||
thread.setPriority(Thread.NORM_PRIORITY + 1);
|
||||
thread.setDaemon(true);
|
||||
|
@ -43,7 +43,7 @@ import sun.java2d.xr.XRGraphicsConfig;
|
||||
import sun.java2d.loops.SurfaceType;
|
||||
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
/**
|
||||
* This is an implementation of a GraphicsDevice object for a single
|
||||
@ -437,12 +437,8 @@ public final class X11GraphicsDevice extends GraphicsDevice
|
||||
}
|
||||
};
|
||||
String name = "Display-Change-Shutdown-Thread-" + screen;
|
||||
Thread t;
|
||||
if (System.getSecurityManager() == null) {
|
||||
t = new Thread(ThreadGroupUtils.getRootThreadGroup(), r, name);
|
||||
} else {
|
||||
t = new InnocuousThread(r, name);
|
||||
}
|
||||
Thread t = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), r, name);
|
||||
t.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(t);
|
||||
return null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -213,12 +213,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
|
||||
public PrintServiceLookupProvider() {
|
||||
// start the printer listener thread
|
||||
if (pollServices) {
|
||||
Thread thr;
|
||||
if (System.getSecurityManager() == null) {
|
||||
thr = new Thread(new PrinterChangeListener());
|
||||
} else {
|
||||
thr = new ManagedLocalsThread(new PrinterChangeListener());
|
||||
}
|
||||
Thread thr = new ManagedLocalsThread(new PrinterChangeListener());
|
||||
thr.setDaemon(true);
|
||||
thr.start();
|
||||
IPPPrintService.debug_println(debugPrefix+"polling turned on");
|
||||
|
@ -41,8 +41,7 @@ import java.util.stream.Stream;
|
||||
import static sun.awt.shell.Win32ShellFolder2.*;
|
||||
import sun.awt.OSInfo;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.misc.InnocuousThread;
|
||||
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
// NOTE: This class supersedes Win32ShellFolderManager, which was removed
|
||||
// from distribution after version 1.4.2.
|
||||
|
||||
@ -525,12 +524,8 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
|
||||
return null;
|
||||
});
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
Thread t;
|
||||
if (System.getSecurityManager() == null) {
|
||||
t = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownHook);
|
||||
} else {
|
||||
t = new InnocuousThread(shutdownHook);
|
||||
}
|
||||
Thread t = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), shutdownHook);
|
||||
Runtime.getRuntime().addShutdownHook(t);
|
||||
return null;
|
||||
});
|
||||
@ -549,17 +544,12 @@ final class Win32ShellFolderManager2 extends ShellFolderManager {
|
||||
};
|
||||
comThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
|
||||
String name = "Swing-Shell";
|
||||
Thread thread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), comRun, name);
|
||||
} else {
|
||||
/* InnocuousThread is a member of a correct TG by default */
|
||||
thread = new InnocuousThread(comRun, name);
|
||||
}
|
||||
/* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
* Make its parent the top-level thread group.
|
||||
*/
|
||||
Thread thread = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), comRun, name);
|
||||
thread.setDaemon(true);
|
||||
return thread;
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -98,11 +98,7 @@ final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(this::_show).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(this::_show).start();
|
||||
}
|
||||
new ManagedLocalsThread(this::_show).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,10 +53,6 @@ final class WPageDialogPeer extends WPrintDialogPeer {
|
||||
}
|
||||
((WPrintDialog)target).setVisible(false);
|
||||
};
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(runnable).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(runnable).start();
|
||||
}
|
||||
new ManagedLocalsThread(runnable).start();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -78,11 +78,7 @@ class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
|
||||
}
|
||||
((WPrintDialog)target).setVisible(false);
|
||||
};
|
||||
if (System.getSecurityManager() == null) {
|
||||
new Thread(runnable).start();
|
||||
} else {
|
||||
new ManagedLocalsThread(runnable).start();
|
||||
}
|
||||
new ManagedLocalsThread(runnable).start();
|
||||
}
|
||||
|
||||
synchronized void setHWnd(long hwnd) {
|
||||
|
@ -51,7 +51,7 @@ import sun.awt.datatransfer.DataTransferer;
|
||||
import sun.java2d.d3d.D3DRenderQueue;
|
||||
import sun.java2d.opengl.OGLRenderQueue;
|
||||
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.print.PrintJob2D;
|
||||
|
||||
import java.awt.dnd.DragSource;
|
||||
@ -255,12 +255,7 @@ public final class WToolkit extends SunToolkit implements Runnable {
|
||||
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
|
||||
if (!startToolkitThread(this, rootTG)) {
|
||||
String name = "AWT-Windows";
|
||||
Thread toolkitThread;
|
||||
if (System.getSecurityManager() == null) {
|
||||
toolkitThread = new Thread(rootTG, this, name);
|
||||
} else {
|
||||
toolkitThread = new InnocuousThread(this, name);
|
||||
}
|
||||
Thread toolkitThread = new ManagedLocalsThread(rootTG, this, name);
|
||||
toolkitThread.setDaemon(true);
|
||||
toolkitThread.start();
|
||||
}
|
||||
@ -287,16 +282,12 @@ public final class WToolkit extends SunToolkit implements Runnable {
|
||||
|
||||
private void registerShutdownHook() {
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
Thread shutdown;
|
||||
if (System.getSecurityManager() == null) {
|
||||
shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
|
||||
} else {
|
||||
shutdown = new InnocuousThread(this::shutdown);
|
||||
}
|
||||
Thread shutdown = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
|
||||
shutdown.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(shutdown);
|
||||
return null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,7 @@ import sun.java2d.SurfaceData;
|
||||
import sun.java2d.windows.GDIWindowSurfaceData;
|
||||
import sun.java2d.d3d.D3DSurfaceData.D3DWindowSurfaceData;
|
||||
import sun.java2d.windows.WindowsFlags;
|
||||
import sun.misc.InnocuousThread;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
/**
|
||||
* This class handles rendering to the screen with the D3D pipeline.
|
||||
@ -99,12 +99,8 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager
|
||||
done = true;
|
||||
wakeUpUpdateThread();
|
||||
};
|
||||
Thread shutdown;
|
||||
if (System.getSecurityManager() == null) {
|
||||
shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
|
||||
} else {
|
||||
shutdown = new InnocuousThread(shutdownRunnable);
|
||||
}
|
||||
Thread shutdown = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
|
||||
shutdown.setContextClassLoader(null);
|
||||
try {
|
||||
Runtime.getRuntime().addShutdownHook(shutdown);
|
||||
@ -351,15 +347,9 @@ public class D3DScreenUpdateManager extends ScreenUpdateManager
|
||||
private synchronized void startUpdateThread() {
|
||||
if (screenUpdater == null) {
|
||||
screenUpdater = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
|
||||
Thread t;
|
||||
String name = "D3D Screen Updater";
|
||||
if (System.getSecurityManager() == null) {
|
||||
t = new Thread(ThreadGroupUtils.getRootThreadGroup(),
|
||||
D3DScreenUpdateManager.this,
|
||||
name);
|
||||
} else {
|
||||
t = new InnocuousThread(D3DScreenUpdateManager.this, name);
|
||||
}
|
||||
Thread t = new ManagedLocalsThread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), this, name);
|
||||
// REMIND: should it be higher?
|
||||
t.setPriority(Thread.NORM_PRIORITY + 2);
|
||||
t.setDaemon(true);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -99,12 +99,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup {
|
||||
return;
|
||||
}
|
||||
// start the printer listener thread
|
||||
Thread thr;
|
||||
if (System.getSecurityManager() == null) {
|
||||
thr = new Thread(new PrinterChangeListener());
|
||||
} else {
|
||||
thr = new ManagedLocalsThread(new PrinterChangeListener());
|
||||
}
|
||||
Thread thr = new ManagedLocalsThread(new PrinterChangeListener());
|
||||
thr.setDaemon(true);
|
||||
thr.start();
|
||||
} /* else condition ought to never happen! */
|
||||
|
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Robot;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8080405
|
||||
* @run main/othervm/policy=java.policy -Djava.security.manager PropertyPermissionOnEDT
|
||||
*/
|
||||
public final class PropertyPermissionOnEDT {
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
SwingUtilities.invokeAndWait(PropertyPermissionOnEDT::test);
|
||||
|
||||
JFrame frame = new JFrame();
|
||||
frame.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
test();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
test();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
test();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
test();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
test();
|
||||
}
|
||||
});
|
||||
frame.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
test();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
test();
|
||||
}
|
||||
});
|
||||
frame.addMouseWheelListener(e -> test());
|
||||
frame.addWindowStateListener(e -> test());
|
||||
|
||||
frame.setSize(100, 100);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
Robot robot = new Robot();
|
||||
robot.setAutoWaitForIdle(true);
|
||||
robot.setAutoDelay(100);
|
||||
Point loc = frame.getLocationOnScreen();
|
||||
robot.mouseMove(loc.x + frame.getWidth() / 2,
|
||||
loc.y + frame.getHeight() / 2);
|
||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||
robot.mouseWheel(100);
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
private static void test() {
|
||||
String property = System.getProperty("os.name");
|
||||
System.out.println("property = " + property);
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
grant {
|
||||
permission java.util.PropertyPermission "os.name", "read";
|
||||
permission java.awt.AWTPermission "createRobot";
|
||||
};
|
Loading…
Reference in New Issue
Block a user