Yuji, I think both changes are good so I add this patch to webrev.
see: http://cr.openjdk.java.net/~dsamersoff/sponsorship/kubota.yuji/JDK-8148104/webrev.02/ -Dmitry On 2016-01-25 13:57, KUBOTA Yuji wrote: > Hi Dmitry and Jaroslav, > > 2016-01-25 18:11 GMT+09:00 Jaroslav Bachorik <jaroslav.bacho...@oracle.com>: >> On 23.1.2016 12:13, Dmitry Samersoff wrote: >>> Solution: >>> >>> Create frame before we initialize agent. >> >> >> While this solution will work in this case I think it would be better to >> daemonize the WorkerThread >> (hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java) >> - that should ensure that the application will be allowed to terminate even >> though the worker thread is still running. > > It's reasonable for me. I could not come up with the reason why the > WorkerThread is not daemonized, so I wrote simply. > I think that WorkerThread can be abandoned when JVM halts, so > recreated the patch to demonize as below. > > jdk9/hs-rt/hotspot (9982:91be2fb6db87) > ---- > diff --git > a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java > b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java > --- > a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java > +++ > b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/WorkerThread.java > @@ -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 > ---- > > Sorry, Dmitry, could you please re-upload this patch if you agree with > this idea? > > Thanks, > Yuji > >> -JB- >> >>> >>> -Dmitry -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources.