Hi Dmitry, Thank you for your time. If you have a comment, please let me know.
Thanks, Yuji 2015-12-15 18:11 GMT+09:00 Dmitry Samersoff <dmitry.samers...@oracle.com>: > Yuji, > > I'll take a look. > > -Dmitry > > On 2015-12-15 11:23, KUBOTA Yuji wrote: >> Hi all, >> >> When I ran HSDB by jhsdb on CLI i.e. without x11 display, HSDB could >> not terminate after throwing HeadlessException. >> >> HSDB starts WorkerThread before making the JFrame. If we run HSDB on >> CLI, HSDB throws HeadlessException when makes the JFrame. Thus, the >> WorkerThread has never shutdown, then HSDB can not terminate. >> >> ----- >> Exception in thread "main" java.awt.HeadlessException: >> No X11 DISPLAY variable was set, but this program performed an >> operation which requires it. >> at >> java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:205) >> at java.awt.Window.<init>(Window.java:535) >> at java.awt.Frame.<init>(Frame.java:422) >> at javax.swing.JFrame.<init>(JFrame.java:224) >> at sun.jvm.hotspot.HSDB.run(HSDB.java:140) >> at sun.jvm.hotspot.HSDB.main(HSDB.java:53) >> at sun.jvm.hotspot.SALauncher.runHSDB(SALauncher.java:167) >> at sun.jvm.hotspot.SALauncher.main(SALauncher.java:339) >> ## Waiting for the shutdown of WorkerThread forever... ### >> ----- >> >> I have created a patch from jdk9/dev/hotspot (changeset: >> 9625:de592ea5f7ba) as below. Please review it ! >> >> diff --git a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java >> b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java >> --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java >> +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java >> @@ -137,15 +137,16 @@ >> return; >> } >> >> + // Make frame at first, then initialize agent. >> + frame = new JFrame("HSDB - HotSpot Debugger"); >> + frame.setSize(800, 600); >> + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); >> + >> 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.DISPOSE_ON_CLOSE); >> - >> JMenuBar menuBar = new JMenuBar(); >> >> // >> >> >> Thanks, >> Yuji >> > > > -- > Dmitry Samersoff > Oracle Java development team, Saint Petersburg, Russia > * I would love to change the world, but they won't give me the source code.