[jboss-svn-commits] JBL Code SVN: r34500 - labs/jbosstm/workspace/emma/emma-2.0.5312-trunk/core/java12/com/vladium/emma/rt.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 4 06:55:12 EDT 2010


Author: adinn
Date: 2010-08-04 06:55:11 -0400 (Wed, 04 Aug 2010)
New Revision: 34500

Modified:
   labs/jbosstm/workspace/emma/emma-2.0.5312-trunk/core/java12/com/vladium/emma/rt/RTExitHook.java
Log:
patched RTExitHook so it checks for System property emma.exit.delay and if it is set and can be parsed to an integer value waits the specified number of seconds before dumping coverage data. this allows coverage data to be collected for other at-exit code

Modified: labs/jbosstm/workspace/emma/emma-2.0.5312-trunk/core/java12/com/vladium/emma/rt/RTExitHook.java
===================================================================
--- labs/jbosstm/workspace/emma/emma-2.0.5312-trunk/core/java12/com/vladium/emma/rt/RTExitHook.java	2010-08-04 10:38:54 UTC (rev 34499)
+++ labs/jbosstm/workspace/emma/emma-2.0.5312-trunk/core/java12/com/vladium/emma/rt/RTExitHook.java	2010-08-04 10:55:11 UTC (rev 34500)
@@ -27,6 +27,14 @@
     
     public synchronized void run ()
     {
+        Integer delay = Integer.getInteger(EMMA_EXIT_DELAY);
+        if (delay != null) {
+            try {
+                Thread.currentThread().sleep(delay.intValue() * 1000);
+            } catch (InterruptedException e) {
+                // ignore
+            }
+        }
         if (m_cdata != null)
         {
             RTCoverageDataPersister.dumpCoverageData (m_cdata, true, m_outFile, m_merge);
@@ -121,6 +129,14 @@
     private ICoverageData m_cdata;
     
     private static final String CLOSURE_RESOURCE = "RTExitHook.closure"; // relative to this package
-    
+
+    /**
+     * this is the name of a property used to determine a delay in seconds for which the shutdown hook will
+     * wait before dumping the emma coverage stats to disk. this can be used to ensure that coverage stats
+     * are gathered for operations performed by other application exit hooks which would otherwise run in
+     * parallel with the emm code and so be truncated part way through execution.
+     */
+    private static final String EMMA_EXIT_DELAY = "emma.exit.delay";
+
 } // end of class
 // ----------------------------------------------------------------------------
\ No newline at end of file



More information about the jboss-svn-commits mailing list