Necessary to avoid losing test data if kill or CTRL+C are called with the following setting (available since JMETER 2.10) jmeter.save.saveservice.autoflush=false
Created attachment 30267 [details] Draft of patch Hello, Attached is a first proposal of Shutdown Hook implementation. I had to add a join on StopThread otherwise it can happen exit occurs before thread is started. Anyway there is still an issue as if shutodwn of threads takes more than jmeterengine.threadstop.wait (ThreadGroup#WAIT_TO_DIE) then it can happen that close will not be called on PrintWriter.
Note: the code in 2.9 and before used autoflush = true
Note that the shutdown hook is run even if JMeter shuts down normally. In which case it should not call engine.stop(true). I wonder if it would be better to implement the shutdown hook in ResultCollector instead. That might avoid some of the problems?
Nice idea sebb. I commited this way. Date: Thu May 9 20:32:55 2013 New Revision: 1480762 URL: http://svn.apache.org/r1480762 Log: Bug 54945 - Add Shutdown Hook to enable trapping kill or CTRL+C signals Bugzilla Id: 54945 Modified: jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java jmeter/trunk/xdocs/changes.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3120