You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/08/07 18:23:31 UTC

svn commit: r983256 - /maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java

Author: bentmann
Date: Sat Aug  7 16:23:31 2010
New Revision: 983256

URL: http://svn.apache.org/viewvc?rev=983256&view=rev
Log:
[MCLEAN-45] Clean plugin should support a silent retry in case the first attemp fails

Modified:
    maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java

Modified: maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java?rev=983256&r1=983255&r2=983256&view=diff
==============================================================================
--- maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java (original)
+++ maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java Sat Aug  7 16:23:31 2010
@@ -212,15 +212,24 @@ class Cleaner
                 // try to release any locks held by non-closed files
                 System.gc();
             }
-            try
-            {
-                Thread.sleep( 10 );
-            }
-            catch ( InterruptedException e )
+
+            boolean deleted = false;
+
+            int[] delays = { 125, 250, 750 };
+            for ( int i = 0; !deleted && i < delays.length; i++ )
             {
-                // ignore
+                try
+                {
+                    Thread.sleep( delays[i] );
+                }
+                catch ( InterruptedException e )
+                {
+                    // ignore
+                }
+                deleted = file.delete() || !file.exists();
             }
-            if ( !file.delete() )
+
+            if ( !deleted )
             {
                 if ( failOnError )
                 {



Re: svn commit: r983256 - /maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java

Posted by Benjamin Bentmann <be...@udo.edu>.
Brett Porter wrote:

>> [MCLEAN-45] Clean plugin should support a silent retry in case the first attemp fails
>
> There's a potential problem here if someone has configured this and has a lot of failures:
>
>    <failOnError>false</failOnError>
>
> Maybe retryOnFailure (default true) needs to be an option as well?

Good catch, thanks, parameter added.


Benjamin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r983256 - /maven/plugins/trunk/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/Cleaner.java

Posted by Brett Porter <br...@apache.org>.
On 08/08/2010, at 2:23 AM, bentmann@apache.org wrote:

> Author: bentmann
> Date: Sat Aug  7 16:23:31 2010
> New Revision: 983256
> 
> URL: http://svn.apache.org/viewvc?rev=983256&view=rev
> Log:
> [MCLEAN-45] Clean plugin should support a silent retry in case the first attemp fails

There's a potential problem here if someone has configured this and has a lot of failures:

  <failOnError>false</failOnError>

Maybe retryOnFailure (default true) needs to be an option as well?

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org