8148104: HSDB could not terminate when launched on CLI
Summary: Create frame before initialize SA
Reviewed-by: jbachorik, dsamersoff
Contributed-by: kubota.yuji@gmail.com
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java Fri Jan 29 03:19:07 2016 +0100
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java Fri Jan 29 15:26:44 2016 +0300
@@ -141,15 +141,19 @@
return;
}
+ // Create frame first, to catch any GUI creation issues
+ // before we initialize agent
+
+ frame = new JFrame("HSDB - HotSpot Debugger");
+ frame.setSize(800, 600);
+ frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+ frame.addWindowListener(new CloseUI());
+
agent = new HotSpotAgent();
workerThread = new WorkerThread();
attachMenuItems = new java.util.ArrayList();
detachMenuItems = new java.util.ArrayList();
- frame = new JFrame("HSDB - HotSpot Debugger");
- frame.setSize(800, 600);
- frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
- frame.addWindowListener(new CloseUI());
JMenuBar menuBar = new JMenuBar();
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java Fri Jan 29 03:19:07 2016 +0100
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java Fri Jan 29 15:26:44 2016 +0300
@@ -35,7 +35,11 @@
public WorkerThread() {
mqb = new MessageQueueBackend();
mq = mqb.getFirstQueue();
- new Thread(new MainLoop()).start();
+
+ // Enable to terminate this worker during runnning by daemonize.
+ Thread mqthread = new Thread(new MainLoop());
+ mqthread.setDaemon(true);
+ mqthread.start();
}
/** Runs the given Runnable in the thread represented by this