8148104: HSDB could not terminate when launched on CLI

Create frame before initialize SA

Reviewed-by: jbachorik, dsamersoff
This commit is contained in:
Yuji Kubota 2016-01-29 15:26:44 +03:00 committed by Dmitry Samersoff
parent b41df1a2e7
commit 7e4e18045a
2 changed files with 13 additions and 5 deletions

View File

@ -141,16 +141,20 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
return;
}
agent = new HotSpotAgent();
workerThread = new WorkerThread();
attachMenuItems = new java.util.ArrayList();
detachMenuItems = new java.util.ArrayList();
// 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();
JMenuBar menuBar = new JMenuBar();
//

View File

@ -35,7 +35,11 @@ public class WorkerThread {
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