Updated Branches:
  refs/heads/master 9cd2acb3e -> 9a3996262

Use ShutdownHookUtils


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/9a399626
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/9a399626
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/9a399626

Branch: refs/heads/master
Commit: 9a39962623a5c7325c495b2e85813a0476b28683
Parents: 463f37b
Author: agudian <andreas.gud...@gmail.com>
Authored: Sun Jan 13 17:16:56 2013 +0100
Committer: Kristian Rosenvold <krosenv...@apache.org>
Committed: Mon Jan 21 19:57:27 2013 +0100

----------------------------------------------------------------------
 .../plugin/surefire/booterclient/ForkStarter.java  |   39 +-------------
 1 files changed, 3 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9a399626/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index 164f8c7..6a2adea 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -51,6 +51,7 @@ import 
org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.shared.utils.cli.CommandLineException;
 import org.apache.maven.shared.utils.cli.CommandLineTimeOutException;
 import org.apache.maven.shared.utils.cli.CommandLineUtils;
+import org.apache.maven.shared.utils.cli.ShutdownHookUtils;
 import org.apache.maven.surefire.booter.Classpath;
 import org.apache.maven.surefire.booter.ClasspathConfiguration;
 import org.apache.maven.surefire.booter.KeyValueSource;
@@ -419,7 +420,7 @@ public class ForkStarter
             testProvidingInputStream.setFlushReceiverProvider( cli );
             inputStreamCloser = new InputStreamCloser( 
testProvidingInputStream );
             inputStreamCloserHook = new Thread( inputStreamCloser );
-            addShutDownHook( inputStreamCloserHook );
+            ShutdownHookUtils.addShutDownHook( inputStreamCloserHook );
         }
         else
         {
@@ -470,7 +471,7 @@ public class ForkStarter
             if ( inputStreamCloser != null )
             {
                 inputStreamCloser.run();
-                removeShutdownHook( inputStreamCloserHook );
+                ShutdownHookUtils.removeShutdownHook( inputStreamCloserHook );
             }
             if ( runResult == null )
             {
@@ -524,38 +525,4 @@ public class ForkStarter
             throw new SurefireBooterForkException( "Unable to create 
classloader to find test suites", e );
         }
     }
-
-    // TODO use ShutdownHookUtils, once it's public again
-    public static void addShutDownHook( Thread hook )
-    {
-        try
-        {
-            Runtime.getRuntime().addShutdownHook( hook );
-        }
-        catch ( IllegalStateException ignore )
-        {
-            // ignore
-        }
-        catch ( AccessControlException ignore )
-        {
-            // ignore
-        }
-    }
-
-    // TODO use ShutdownHookUtils, once it's public again
-    public static void removeShutdownHook( Thread hook )
-    {
-        try
-        {
-            Runtime.getRuntime().removeShutdownHook( hook );
-        }
-        catch ( IllegalStateException ignore )
-        {
-            // ignore
-        }
-        catch ( AccessControlException ignore )
-        {
-            // ignore
-        }
-    }
 }

Reply via email to