RFR(S): JDK-8148104 HSDB could not terminate when launched on CLI.
KUBOTA Yuji
kubota.yuji at gmail.com
Mon Jan 25 10:57:25 UTC 2016
Hi Dmitry and Jaroslav,
2016-01-25 18:11 GMT+09:00 Jaroslav Bachorik <jaroslav.bachorik at 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
More information about the serviceability-dev
mailing list