8147544: Remove sun.misc.ManagedLocalsThread from java.desktop
Reviewed-by: serb, chegar
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java Mon Apr 04 14:22:07 2016 -0700
@@ -35,7 +35,6 @@
import javax.swing.filechooser.FileSystemView;
import javax.swing.table.AbstractTableModel;
-import sun.misc.ManagedLocalsThread;
/**
* NavServices-like implementation of a file Table
*
@@ -393,7 +392,7 @@
this.currentDirectory = currentDirectory;
this.fid = fid;
String name = "Aqua L&F File Loading Thread";
- this.loadThread = new ManagedLocalsThread(this, name);
+ this.loadThread = new Thread(null, this, name, 0, false);
this.loadThread.start();
}
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java Mon Apr 04 14:22:07 2016 -0700
@@ -42,7 +42,6 @@
import sun.awt.HeadlessToolkit;
import sun.awt.util.ThreadGroupUtils;
import sun.lwawt.macosx.*;
-import sun.misc.ManagedLocalsThread;
public final class CFontManager extends SunFontManager {
private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java Mon Apr 04 14:22:07 2016 -0700
@@ -35,7 +35,6 @@
import java.util.*;
import sun.awt.*;
-import sun.misc.ManagedLocalsThread;
import sun.print.*;
import sun.awt.util.ThreadGroupUtils;
@@ -77,13 +76,14 @@
shutdown();
waitForRunState(STATE_CLEANUP);
};
- Thread shutdown = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
+ Thread shutdown = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable,
+ "AWT-Shutdown", 0, false);
shutdown.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(shutdown);
String name = "AWT-LW";
- Thread toolkitThread = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), this, name);
+ Thread toolkitThread = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), this, name, 0, false);
toolkitThread.setDaemon(true);
toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
toolkitThread.start();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -44,7 +44,6 @@
import sun.lwawt.LWComponentPeer;
import sun.lwawt.LWWindowPeer;
import sun.lwawt.PlatformWindow;
-import sun.misc.ManagedLocalsThread;
public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
@@ -181,7 +180,7 @@
}
}
};
- new ManagedLocalsThread(dragRunnable).start();
+ new Thread(null, dragRunnable, "Drag", 0, false).start();
} catch (Exception e) {
final long nativeDragSource = getNativeContext();
setNativeContext(0);
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java Mon Apr 04 14:22:07 2016 -0700
@@ -37,7 +37,6 @@
import sun.awt.CausedFocusEvent.Cause;
import sun.awt.AWTAccessor;
import sun.java2d.pipe.Region;
-import sun.misc.ManagedLocalsThread;
import sun.security.action.GetBooleanAction;
class CFileDialog implements FileDialogPeer {
@@ -120,7 +119,7 @@
if (visible) {
// Java2 Dialog class requires peer to run code in a separate thread
// and handles keeping the call modal
- new ManagedLocalsThread(new Task()).start();
+ new Thread(null, new Task(), "FileDialog", 0, false).start();
}
// We hide ourself before "show" returns - setVisible(false)
// doesn't apply
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -29,7 +29,6 @@
import java.awt.dnd.*;
import sun.lwawt.*;
-import sun.misc.ManagedLocalsThread;
public class CPrinterDialogPeer extends LWWindowPeer {
static {
@@ -59,7 +58,7 @@
printerDialog.setRetVal(printerDialog.showDialog());
printerDialog.setVisible(false);
};
- new ManagedLocalsThread(task).start();
+ new Thread(null, task, "PrintDialog", 0, false).start();
}
}
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Mon Apr 04 14:22:07 2016 -0700
@@ -44,7 +44,6 @@
import javax.print.attribute.standard.PageRanges;
import sun.java2d.*;
-import sun.misc.ManagedLocalsThread;
import sun.print.*;
public final class CPrinterJob extends RasterPrinterJob {
@@ -775,7 +774,8 @@
// upcall from native
private static void detachPrintLoop(final long target, final long arg) {
- new ManagedLocalsThread(() -> _safePrintLoop(target, arg)).start();
+ new Thread(null, () -> _safePrintLoop(target, arg),
+ "PrintLoop", 0, false).start();
}
private static native void _safePrintLoop(long target, long arg);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java Mon Apr 04 14:22:07 2016 -0700
@@ -26,7 +26,6 @@
package com.sun.imageio.stream;
import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
import java.io.IOException;
import java.security.AccessController;
@@ -92,8 +91,8 @@
* Make its parent the top-level thread group.
*/
ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup();
- streamCloser = new ManagedLocalsThread(tg,
- streamCloserRunnable);
+ streamCloser = new Thread(tg, streamCloserRunnable,
+ "StreamCloser", 0, false);
/* Set context class loader to null in order to avoid
* keeping a strong reference to an application classloader.
*/
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Mon Apr 04 14:22:07 2016 -0700
@@ -64,7 +64,6 @@
import sun.awt.OSInfo;
import sun.awt.shell.ShellFolder;
import sun.font.FontUtilities;
-import sun.misc.ManagedLocalsThread;
import sun.security.action.GetPropertyAction;
import sun.swing.DefaultLayoutStyle;
@@ -2053,7 +2052,7 @@
if (audioRunnable != null) {
// Runnable appears to block until completed playing, hence
// start up another thread to handle playing.
- new ManagedLocalsThread(audioRunnable).start();
+ new Thread(null, audioRunnable, "Audio", 0, false).start();
}
}
}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java Mon Apr 04 14:22:07 2016 -0700
@@ -25,8 +25,6 @@
package com.sun.media.sound;
-import sun.misc.ManagedLocalsThread;
-
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.File;
@@ -145,12 +143,11 @@
static Thread createThread(final Runnable runnable,
final String threadName,
final boolean isDaemon, final int priority,
- final boolean doStart) {
- Thread thread = new ManagedLocalsThread(runnable);
+ final boolean doStart)
+ {
+ String name = (threadName != null) ? threadName : "JSSM Thread";
+ Thread thread = new Thread(null, runnable, threadName, 0, false);
- if (threadName != null) {
- thread.setName(threadName);
- }
thread.setDaemon(isDaemon);
if (priority >= 0) {
thread.setPriority(priority);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java Mon Apr 04 14:22:07 2016 -0700
@@ -24,8 +24,6 @@
*/
package com.sun.media.sound;
-import sun.misc.ManagedLocalsThread;
-
import java.io.IOException;
import javax.sound.sampled.AudioInputStream;
@@ -55,7 +53,7 @@
if (active)
return;
active = true;
- audiothread = new ManagedLocalsThread(this);
+ audiothread = new Thread(null, this, "AudioPusher", 0, false);
audiothread.setDaemon(true);
audiothread.setPriority(Thread.MAX_PRIORITY);
audiothread.start();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java Mon Apr 04 14:22:07 2016 -0700
@@ -24,8 +24,6 @@
*/
package com.sun.media.sound;
-import sun.misc.ManagedLocalsThread;
-
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import java.io.EOFException;
@@ -216,7 +214,7 @@
}
};
- thread = new ManagedLocalsThread(runnable);
+ thread = new Thread(null, runnable, "JitterCorrector", 0, false);
thread.setDaemon(true);
thread.setPriority(Thread.MAX_PRIORITY);
thread.start();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Mon Apr 04 14:22:07 2016 -0700
@@ -25,8 +25,6 @@
package com.sun.media.sound;
-import sun.misc.ManagedLocalsThread;
-
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -141,7 +139,7 @@
pusher = null;
jitter_stream = null;
sourceDataLine = null;
- new ManagedLocalsThread(runnable).start();
+ new Thread(null, runnable, "Synthesizer",0,false).start();
}
return len;
}
--- a/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java Mon Apr 04 14:22:07 2016 -0700
@@ -31,7 +31,6 @@
import java.util.ArrayList;
-import sun.misc.ManagedLocalsThread;
import sun.util.logging.PlatformLogger;
import sun.awt.dnd.SunDragSourceContextPeer;
@@ -55,7 +54,7 @@
*
* @since 1.1
*/
-class EventDispatchThread extends ManagedLocalsThread {
+class EventDispatchThread extends Thread {
private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread");
@@ -66,8 +65,16 @@
private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>();
+ /**
+ * Must always call 5 args super-class constructor passing false
+ * to indicate not to inherit locals.
+ */
+ private EventDispatchThread() {
+ throw new UnsupportedOperationException("Must erase locals");
+ }
+
EventDispatchThread(ThreadGroup group, String name, EventQueue queue) {
- super(group, name);
+ super(group, null, name, 0, false);
setEventQueue(queue);
}
--- a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java Mon Apr 04 14:22:07 2016 -0700
@@ -35,8 +35,6 @@
package java.awt.image.renderable;
-import sun.misc.ManagedLocalsThread;
-
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.ImageConsumer;
@@ -137,7 +135,7 @@
addConsumer(ic);
// Need to build a runnable object for the Thread.
String name = "RenderableImageProducer Thread";
- Thread thread = new ManagedLocalsThread(this, name);
+ Thread thread = new Thread(null, this, name, 0, false);
thread.start();
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java Mon Apr 04 14:22:07 2016 -0700
@@ -56,7 +56,6 @@
import javax.print.attribute.*;
import javax.print.PrintService;
-import sun.misc.ManagedLocalsThread;
import sun.reflect.misc.ReflectUtil;
import sun.swing.SwingUtilities2;
@@ -6375,7 +6374,7 @@
};
// start printing on another thread
- Thread th = new ManagedLocalsThread(runnable);
+ Thread th = new Thread(null, runnable, "JTablePrint", 0, false);
th.start();
printingStatus.showModal(true);
--- a/jdk/src/java.desktop/share/classes/javax/swing/TimerQueue.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/TimerQueue.java Mon Apr 04 14:22:07 2016 -0700
@@ -36,7 +36,6 @@
import java.util.concurrent.locks.*;
import java.util.concurrent.atomic.AtomicLong;
import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
/**
* Internal class to manage all Timers using one thread.
@@ -101,8 +100,8 @@
final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
String name = "TimerQueue";
- Thread timerThread = new ManagedLocalsThread(threadGroup,
- this, name);
+ Thread timerThread =
+ new Thread(threadGroup, this, name, 0, false);
timerThread.setDaemon(true);
timerThread.setPriority(Thread.NORM_PRIORITY);
timerThread.start();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Mon Apr 04 14:22:07 2016 -0700
@@ -26,7 +26,6 @@
package javax.swing.plaf.basic;
import sun.awt.shell.ShellFolder;
-import sun.misc.ManagedLocalsThread;
import javax.swing.*;
import javax.swing.event.ListDataEvent;
@@ -271,7 +270,7 @@
this.currentDirectory = currentDirectory;
this.fid = fid;
String name = "Basic L&F File Loading Thread";
- this.loadThread = new ManagedLocalsThread(this, name);
+ this.loadThread = new Thread(null, this, name, 0, false);
this.loadThread.start();
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Mon Apr 04 14:22:07 2016 -0700
@@ -70,7 +70,6 @@
import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
import sun.swing.PrintingStatus;
import sun.swing.SwingUtilities2;
import sun.swing.text.TextComponentPrintable;
@@ -2353,7 +2352,8 @@
runnablePrinting.run();
} else {
if (isEventDispatchThread) {
- new ManagedLocalsThread(runnablePrinting).start();
+ new Thread(null, runnablePrinting,
+ "JTextComponentPrint", 0, false ).start();
printingStatus.showModal(true);
} else {
printingStatus.showModal(false);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java Mon Apr 04 14:22:07 2016 -0700
@@ -26,7 +26,6 @@
import java.util.Vector;
import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
/**
* A queue of text layout tasks.
@@ -92,7 +91,7 @@
}
} while (work != null);
};
- worker = new ManagedLocalsThread(workerRunnable, "text-layout");
+ worker = new Thread(null, workerRunnable, "text-layout", 0, false);
worker.setPriority(Thread.MIN_PRIORITY);
worker.start();
}
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java Mon Apr 04 14:22:07 2016 -0700
@@ -52,7 +52,6 @@
import java.security.PermissionCollection;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
-import sun.misc.ManagedLocalsThread;
import sun.net.www.ParseUtil;
import sun.security.util.SecurityConstants;
@@ -858,13 +857,20 @@
* this operation to complete before continuing, wait for the notifyAll()
* operation on the syncObject to occur.
*/
-class AppContextCreator extends ManagedLocalsThread {
+class AppContextCreator extends Thread {
Object syncObject = new Object();
AppContext appContext = null;
volatile boolean created = false;
+ /**
+ * Must call the 5-args super-class constructor to erase locals.
+ */
+ private AppContextCreator() {
+ throw new UnsupportedOperationException("Must erase locals");
+ }
+
AppContextCreator(ThreadGroup group) {
- super(group, "AppContextCreator");
+ super(group, null, "AppContextCreator", 0, false);
}
public void run() {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java Mon Apr 04 14:22:07 2016 -0700
@@ -44,7 +44,6 @@
import sun.awt.EmbeddedFrame;
import sun.awt.SunToolkit;
import sun.awt.util.PerformanceLogger;
-import sun.misc.ManagedLocalsThread;
import sun.security.util.SecurityConstants;
/**
@@ -166,7 +165,7 @@
ThreadGroup appletGroup = loader.getThreadGroup();
- handler = new ManagedLocalsThread(appletGroup, this, "thread " + nm);
+ handler = new Thread(appletGroup, this, "thread " + nm, 0, false);
// set the context class loader for this thread
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
@@ -396,9 +395,8 @@
// until the loader thread terminates.
// (one way or another).
if (loaderThread == null) {
- // REMIND: do we want a name?
- //System.out.println("------------------- loading applet");
- setLoaderThread(new ManagedLocalsThread(this));
+ setLoaderThread(new Thread(null, this,
+ "AppletLoader", 0, false));
loaderThread.start();
// we get to go to sleep while this runs
loaderThread.join();
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java Mon Apr 04 14:22:07 2016 -0700
@@ -38,7 +38,6 @@
import java.security.PrivilegedAction;
import sun.awt.SunToolkit;
import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
/**
* A frame to show the applet tag in.
@@ -854,7 +853,7 @@
//
final AppletPanel p = panel;
- new ManagedLocalsThread(new Runnable()
+ new Thread(null, new Runnable()
{
@Override
public void run()
@@ -867,7 +866,8 @@
appletSystemExit();
}
}
- }).start();
+ },
+ "AppletCloser", 0, false).start();
}
/**
@@ -890,7 +890,7 @@
// spawn a new thread to avoid blocking the event queue
// when calling appletShutdown.
//
- new ManagedLocalsThread(new Runnable()
+ new Thread(null, new Runnable()
{
@Override
public void run()
@@ -901,7 +901,8 @@
}
appletSystemExit();
}
- }).start();
+ },
+ "AppletQuit", 0, false).start();
}
/**
--- a/jdk/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java Mon Apr 04 14:22:07 2016 -0700
@@ -34,7 +34,6 @@
import java.util.Set;
import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
import sun.util.logging.PlatformLogger;
/**
@@ -337,8 +336,8 @@
private void activateBlockerThread() {
AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
String name = "AWT-Shutdown";
- Thread thread = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), this, name);
+ Thread thread = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), this, name, 0, false);
thread.setContextClassLoader(null);
thread.setDaemon(false);
blockerThread = thread;
--- a/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java Mon Apr 04 14:22:07 2016 -0700
@@ -46,7 +46,6 @@
import jdk.internal.misc.JavaAWTAccess;
import jdk.internal.misc.SharedSecrets;
-import sun.misc.ManagedLocalsThread;
import sun.util.logging.PlatformLogger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
@@ -598,8 +597,8 @@
}
public Thread run() {
- Thread t = new ManagedLocalsThread(appContext.getThreadGroup(),
- runnable, "AppContext Disposer");
+ Thread t = new Thread(appContext.getThreadGroup(),
+ runnable, "AppContext Disposer", 0, false);
t.setContextClassLoader(appContext.getContextClassLoader());
t.setPriority(Thread.NORM_PRIORITY + 1);
t.setDaemon(true);
--- a/jdk/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java Mon Apr 04 14:22:07 2016 -0700
@@ -55,7 +55,6 @@
import java.util.prefs.Preferences;
import sun.awt.InputMethodSupport;
import sun.awt.SunToolkit;
-import sun.misc.ManagedLocalsThread;
/**
* {@code InputMethodManager} is an abstract class that manages the input
@@ -166,7 +165,8 @@
// to choose from. Otherwise, just keep the instance.
if (imm.hasMultipleInputMethods()) {
imm.initialize();
- Thread immThread = new ManagedLocalsThread(imm, threadName);
+ Thread immThread =
+ new Thread(null, imm, threadName, 0, false);
immThread.setDaemon(true);
immThread.setPriority(Thread.NORM_PRIORITY + 1);
immThread.start();
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java Mon Apr 04 14:22:07 2016 -0700
@@ -27,7 +27,6 @@
import java.util.Vector;
import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
/**
* An ImageFetcher is a thread used to fetch ImageFetchable objects.
@@ -42,7 +41,7 @@
* @author Jim Graham
* @author Fred Ecks
*/
-class ImageFetcher extends ManagedLocalsThread {
+class ImageFetcher extends Thread {
static final int HIGH_PRIORITY = 8;
static final int LOW_PRIORITY = 3;
static final int ANIM_PRIORITY = 2;
@@ -52,10 +51,17 @@
// queue before an ImageFetcher dies
/**
+ * We must only call the 5 args super() constructor passing
+ * in "false" to indicate to not inherit locals.
+ */
+ private ImageFetcher() {
+ throw new UnsupportedOperationException("Must erase locals");
+ }
+ /**
* Constructor for ImageFetcher -- only called by add() below.
*/
private ImageFetcher(ThreadGroup threadGroup, int index) {
- super(threadGroup, "Image Fetcher " + index);
+ super(threadGroup, null, "Image Fetcher " + index, 0, false);
setDaemon(true);
}
--- a/jdk/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java Mon Apr 04 14:22:07 2016 -0700
@@ -36,7 +36,6 @@
import sun.awt.AppContext;
import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
public class CreatedFontTracker {
@@ -122,8 +121,8 @@
* Make its parent the top-level thread group.
*/
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
- t = new ManagedLocalsThread(rootTG,
- TempFileDeletionHook::runHooks);
+ t = new Thread(rootTG, TempFileDeletionHook::runHooks,
+ "TempFontFileDeleter", 0, false);
/* Set context class loader to null in order to avoid
* keeping a strong reference to an application classloader.
*/
--- a/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java Mon Apr 04 14:22:07 2016 -0700
@@ -55,7 +55,6 @@
import sun.awt.SunToolkit;
import sun.awt.util.ThreadGroupUtils;
import sun.java2d.FontSupport;
-import sun.misc.ManagedLocalsThread;
import sun.util.logging.PlatformLogger;
/**
@@ -2513,8 +2512,8 @@
};
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
- fileCloser = new ManagedLocalsThread(rootTG,
- fileCloserRunnable);
+ fileCloser = new Thread(rootTG, fileCloserRunnable,
+ "FileCloser", 0, false);
fileCloser.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(fileCloser);
return null;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/Disposer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/Disposer.java Mon Apr 04 14:22:07 2016 -0700
@@ -26,7 +26,6 @@
package sun.java2d;
import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
@@ -85,7 +84,7 @@
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
String name = "Java2D Disposer";
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
- Thread t = new ManagedLocalsThread(rootTG, disposerInstance, name);
+ Thread t = new Thread(rootTG, disposerInstance, name, 0, false);
t.setContextClassLoader(null);
t.setDaemon(true);
t.setPriority(Thread.MAX_PRIORITY);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java Mon Apr 04 14:22:07 2016 -0700
@@ -48,7 +48,6 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
-import sun.misc.ManagedLocalsThread;
import sun.security.action.GetPropertyAction;
/**
@@ -420,8 +419,9 @@
public static void setShutdownHook() {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
TraceReporter t = new TraceReporter();
- Thread thread = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), t);
+ Thread thread = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), t,
+ "TraceReporter", 0, false);
thread.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(thread);
return null;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java Mon Apr 04 14:22:07 2016 -0700
@@ -28,7 +28,6 @@
import sun.awt.util.ThreadGroupUtils;
import sun.java2d.pipe.RenderBuffer;
import sun.java2d.pipe.RenderQueue;
-import sun.misc.ManagedLocalsThread;
import static sun.java2d.pipe.BufferedOpCodes.*;
import java.security.AccessController;
@@ -161,7 +160,8 @@
public QueueFlusher() {
String name = "Java2D Queue Flusher";
- thread = new ManagedLocalsThread(ThreadGroupUtils.getRootThreadGroup(), this, name);
+ thread = new Thread(ThreadGroupUtils.getRootThreadGroup(),
+ this, name, 0, false);
thread.setDaemon(true);
thread.setPriority(Thread.MAX_PRIORITY);
thread.start();
--- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java Mon Apr 04 14:22:07 2016 -0700
@@ -71,7 +71,6 @@
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.PageRanges;
-import sun.misc.ManagedLocalsThread;
import sun.print.SunPageSelection;
import sun.print.SunMinMaxPage;
@@ -1009,7 +1008,8 @@
}
private void startPrinterJobThread() {
- printerJobThread = new ManagedLocalsThread(this, "printerJobThread");
+ printerJobThread =
+ new Thread(null, this, "printerJobThread", 0, false);
printerJobThread.start();
}
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceNotifier.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceNotifier.java Mon Apr 04 14:22:07 2016 -0700
@@ -25,8 +25,6 @@
package sun.print;
-import sun.misc.ManagedLocalsThread;
-
import java.util.Vector;
import javax.print.PrintService;
@@ -42,15 +40,19 @@
* to obtain the state of the attributes and notifies the listeners of
* any changes.
*/
-class ServiceNotifier extends ManagedLocalsThread {
+class ServiceNotifier extends Thread {
private PrintService service;
private Vector<PrintServiceAttributeListener> listeners;
private boolean stop = false;
private PrintServiceAttributeSet lastSet;
+ /*
+ * If adding any other constructors, always call the 5-args
+ * super-class constructor passing "false" for inherit-locals.
+ */
ServiceNotifier(PrintService service) {
- super(service.getName() + " notifier");
+ super(null, null, service.getName() + " notifier", 0, false);
this.service = service;
listeners = new Vector<>();
try {
@@ -70,7 +72,7 @@
}
}
- void removeListener(PrintServiceAttributeListener listener) {
+ void removeListener(PrintServiceAttributeListener listener) {
synchronized (this) {
if (listener == null || listeners == null) {
return;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -29,7 +29,6 @@
import java.io.File;
import java.io.FilenameFilter;
import sun.awt.AWTAccessor;
-import sun.misc.ManagedLocalsThread;
/**
* FileDialogPeer for the GtkFileChooser.
@@ -120,7 +119,7 @@
standaloneWindow = 0;
fd.setVisible(false);
};
- new ManagedLocalsThread(task).start();
+ new Thread(null, task, "ShowDialog", 0, false).start();
} else {
quit();
fd.setVisible(false);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java Mon Apr 04 14:22:07 2016 -0700
@@ -29,7 +29,6 @@
import java.awt.event.*;
import java.awt.peer.TrayIconPeer;
import sun.awt.*;
-import sun.misc.ManagedLocalsThread;
import java.awt.image.*;
import java.text.BreakIterator;
@@ -452,7 +451,7 @@
final Thread thread;
Displayer() {
- this.thread = new ManagedLocalsThread(this);
+ this.thread = new Thread(null, this, "Displayer", 0, false);
this.thread.setDaemon(true);
}
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -29,7 +29,6 @@
import java.awt.Taskbar.Feature;
import java.awt.peer.TaskbarPeer;
import java.awt.event.ActionEvent;
-import sun.misc.ManagedLocalsThread;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
@@ -48,10 +47,8 @@
new GetPropertyAction("java.desktop.appName", ""));
nativeLibraryLoaded = init(dname);
if (nativeLibraryLoaded) {
- ManagedLocalsThread t
- = new ManagedLocalsThread(() -> {
- runloop();
- });
+ Thread t = new Thread(null, () -> { runloop(); },
+ "TaskBar", 0, false);
t.setDaemon(true);
t.start();
}
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java Mon Apr 04 14:22:07 2016 -0700
@@ -284,8 +284,8 @@
}
};
String name = "XToolkt-Shutdown-Thread";
- Thread shutdownThread = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), r, name);
+ Thread shutdownThread = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), r, name, 0, false);
shutdownThread.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(shutdownThread);
return null;
@@ -332,8 +332,9 @@
toolkitThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
String name = "AWT-XAWT";
- Thread thread = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), this, name);
+ Thread thread = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), this, name,
+ 0, false);
thread.setContextClassLoader(null);
thread.setPriority(Thread.NORM_PRIORITY + 1);
thread.setDaemon(true);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java Mon Apr 04 14:22:07 2016 -0700
@@ -44,7 +44,6 @@
import sun.awt.util.ThreadGroupUtils;
import sun.java2d.SunGraphicsEnvironment;
-import sun.misc.ManagedLocalsThread;
/**
* This is an implementation of a GraphicsDevice object for a single
@@ -442,8 +441,8 @@
}
};
String name = "Display-Change-Shutdown-Thread-" + screen;
- Thread t = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), r, name);
+ Thread t = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), r, name, 0, false);
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
--- a/jdk/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Mon Apr 04 14:22:07 2016 -0700
@@ -25,8 +25,6 @@
package sun.print;
-import sun.misc.ManagedLocalsThread;
-
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -213,7 +211,8 @@
public PrintServiceLookupProvider() {
// start the printer listener thread
if (pollServices) {
- Thread thr = new ManagedLocalsThread(new PrinterChangeListener());
+ Thread thr = new Thread(null, new PrinterChangeListener(),
+ "PrinterListener", 0, false);
thr.setDaemon(true);
thr.start();
IPPPrintService.debug_println(debugPrefix+"polling turned on");
--- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Mon Apr 04 14:22:07 2016 -0700
@@ -41,7 +41,6 @@
import static sun.awt.shell.Win32ShellFolder2.*;
import sun.awt.OSInfo;
import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
// NOTE: This class supersedes Win32ShellFolderManager, which was removed
// from distribution after version 1.4.2.
@@ -524,8 +523,9 @@
return null;
});
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
- Thread t = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), shutdownHook);
+ Thread t = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), shutdownHook,
+ "ShellFolder", 0, false);
Runtime.getRuntime().addShutdownHook(t);
return null;
});
@@ -548,8 +548,9 @@
* 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 thread = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), comRun, name,
+ 0, false);
thread.setDaemon(true);
return thread;
});
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -36,7 +36,6 @@
import java.util.Vector;
import sun.awt.CausedFocusEvent;
import sun.awt.AWTAccessor;
-import sun.misc.ManagedLocalsThread;
final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
@@ -98,7 +97,7 @@
@Override
public void show() {
- new ManagedLocalsThread(this::_show).start();
+ new Thread(null, this::_show, "FileDialog", 0, false).start();
}
@Override
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialogPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialogPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -25,8 +25,6 @@
package sun.awt.windows;
-import sun.misc.ManagedLocalsThread;
-
final class WPageDialogPeer extends WPrintDialogPeer {
WPageDialogPeer(WPageDialog target) {
@@ -53,6 +51,6 @@
}
((WPrintDialog)target).setVisible(false);
};
- new ManagedLocalsThread(runnable).start();
+ new Thread(null, runnable, "PageDialog", 0, false).start();
}
}
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java Mon Apr 04 14:22:07 2016 -0700
@@ -32,7 +32,6 @@
import java.util.Vector;
import sun.awt.CausedFocusEvent;
import sun.awt.AWTAccessor;
-import sun.misc.ManagedLocalsThread;
class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
@@ -78,7 +77,7 @@
}
((WPrintDialog)target).setVisible(false);
};
- new ManagedLocalsThread(runnable).start();
+ new Thread(null, runnable, "PrintDialog", 0, false).start();
}
synchronized void setHWnd(long hwnd) {
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Mon Apr 04 14:22:07 2016 -0700
@@ -52,7 +52,6 @@
import sun.java2d.d3d.D3DRenderQueue;
import sun.java2d.opengl.OGLRenderQueue;
-import sun.misc.ManagedLocalsThread;
import sun.print.PrintJob2D;
import java.awt.dnd.DragSource;
@@ -256,7 +255,7 @@
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
String name = "AWT-Windows";
- Thread toolkitThread = new ManagedLocalsThread(rootTG, this, name);
+ Thread toolkitThread = new Thread(rootTG, this, name, 0, false);
toolkitThread.setDaemon(true);
toolkitThread.start();
}
@@ -283,8 +282,9 @@
private void registerShutdownHook() {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
- Thread shutdown = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
+ Thread shutdown = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), this::shutdown,
+ "ToolkitShutdown", 0, false);
shutdown.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(shutdown);
return null;
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java Mon Apr 04 14:22:07 2016 -0700
@@ -49,7 +49,6 @@
import sun.java2d.windows.GDIWindowSurfaceData;
import sun.java2d.d3d.D3DSurfaceData.D3DWindowSurfaceData;
import sun.java2d.windows.WindowsFlags;
-import sun.misc.ManagedLocalsThread;
/**
* This class handles rendering to the screen with the D3D pipeline.
@@ -99,8 +98,9 @@
done = true;
wakeUpUpdateThread();
};
- Thread shutdown = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
+ Thread shutdown = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable,
+ "ScreenUpdater", 0, false);
shutdown.setContextClassLoader(null);
try {
Runtime.getRuntime().addShutdownHook(shutdown);
@@ -348,8 +348,9 @@
if (screenUpdater == null) {
screenUpdater = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
String name = "D3D Screen Updater";
- Thread t = new ManagedLocalsThread(
- ThreadGroupUtils.getRootThreadGroup(), this, name);
+ Thread t = new Thread(
+ ThreadGroupUtils.getRootThreadGroup(), this, name,
+ 0, false);
// REMIND: should it be higher?
t.setPriority(Thread.NORM_PRIORITY + 2);
t.setDaemon(true);
--- a/jdk/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java Mon Apr 04 16:54:59 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java Mon Apr 04 14:22:07 2016 -0700
@@ -25,8 +25,6 @@
package sun.print;
-import sun.misc.ManagedLocalsThread;
-
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -99,7 +97,8 @@
return;
}
// start the printer listener thread
- Thread thr = new ManagedLocalsThread(new PrinterChangeListener());
+ Thread thr = new Thread(null, new PrinterChangeListener(),
+ "PrinterListener", 0, false);
thr.setDaemon(true);
thr.start();
} /* else condition ought to never happen! */