[jboss-svn-commits] JBL Code SVN: r20819 - labs/jbossrules/trunk/drools-core/src/test/java/org/drools/agent.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 26 14:12:15 EDT 2008


Author: mark.proctor at jboss.com
Date: 2008-06-26 14:12:15 -0400 (Thu, 26 Jun 2008)
New Revision: 20819

Modified:
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/agent/RuleBaseAssemblerTest.java
Log:
-put in a small wait, to see if we can still delete a file or not.

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/agent/RuleBaseAssemblerTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/agent/RuleBaseAssemblerTest.java	2008-06-26 17:59:49 UTC (rev 20818)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/agent/RuleBaseAssemblerTest.java	2008-06-26 18:12:15 UTC (rev 20819)
@@ -76,10 +76,23 @@
         if (dir.isDirectory()) {
             String[] children = dir.list();
             for (String child : children) {
-                boolean success = deleteDir(new File(dir, child));
+                File file = new File(dir, child);
+                boolean success = deleteDir( file );
                 if (!success) {                    
-                    //throw new RuntimeException("Unable to delete !");
-                    return false;
+                    // this is a hack, but some time you need to wait for a file release to release
+                    // Windows was having intermittent issues with DirectoryScannerTest with the dir not being empty
+                    System.gc();
+                    try {
+                        Thread.sleep( 300 );
+                    } catch ( InterruptedException e ) {
+                        throw new RuntimeException( "This should never happen" );
+                    }
+                    success = deleteDir( file );
+                    if ( !success) {
+                        //ok now give up 
+                        //throw new RuntimeException("Unable to delete !");
+                        return false;
+                    }
                 }
             }
         }




More information about the jboss-svn-commits mailing list