agilord / oktech-profiler

Automatically exported from code.google.com/p/oktech-profiler
0 stars 0 forks source link

JVM doesn't shut down after tested application finished #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. checkout latest (revision 50) source from subversion, compile.
2. java
-javaagent:hu.oktech.profiler-java-runtime-1.1-SNAPSHOT-jar-with-dependencies.ja
r
-jar Myjar.jar

What is the expected output? What do you see instead?

The JVM should shut down after the tested application finishes, but it
doesn't, unless dumper.thread.daemon=true is explicitly specified.

Original issue reported on code.google.com by deaka...@gmail.com on 13 Sep 2009 at 6:18

Attachments:

GoogleCodeExporter commented 8 years ago
Shutdown hook was responsible to end the dumper when running as a non-daemon 
thread,
as Runtime.addShutdownHook javadoc states "The program exits normally, when the 
last
non-daemon thread exits", it couldn't while the dumper thread was running.
Solution: the dumper always runs as a daemon thread, when the JVM shuts down 
the last
thousand entries from the data queue are written to file, the limit makes sure 
that
the virtual machine shuts down relatively fast as required.
The added synchronization doesn't affect the performance of the profiler 
adversely. 

Original comment by deaka...@gmail.com on 13 Sep 2009 at 8:36