[jboss-cvs] JBossAS SVN: r87399 - projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 16 01:22:31 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-04-16 01:22:31 -0400 (Thu, 16 Apr 2009)
New Revision: 87399

Modified:
   projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java
Log:
JBVFS-106 - sane interrupt handling

Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java	2009-04-16 03:47:55 UTC (rev 87398)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/zip/ZipFileWrapper.java	2009-04-16 05:22:31 UTC (rev 87399)
@@ -310,26 +310,34 @@
       if (exists == false)
          return false;
 
-      long endOfGrace = System.currentTimeMillis() + gracePeriod;
-      do
+      boolean interrupted = Thread.interrupted();
+      try
       {
-         closeZipFile();
-         ZipFileLockReaper.getInstance().deleteFile(this);
-         try
+         long endOfGrace = System.currentTimeMillis() + gracePeriod;
+         do
          {
-            if (file.exists() && file.delete() == false)
-               Thread.sleep(100);
-            else
-               return true;
+            closeZipFile();
+            ZipFileLockReaper.getInstance().deleteFile(this);
+            try
+            {
+               if (file.exists() && file.delete() == false)
+                  Thread.sleep(100);
+               else
+                  return true;
+            }
+            catch (InterruptedException e)
+            {
+               interrupted = true;
+               return ! file.exists() || file.delete() && ! file.exists();
+            }
          }
-         catch (InterruptedException e)
-         {
-            IOException ioe = new IOException("Interrupted: " + e);
-            ioe.initCause(e);
-            throw ioe;
-         }
+         while(System.currentTimeMillis() < endOfGrace);
       }
-      while(System.currentTimeMillis() < endOfGrace);
+      finally
+      {
+         if (interrupted)
+            Thread.currentThread().interrupt();
+      }
 
       file.delete();
       return file.exists() == false;




More information about the jboss-cvs-commits mailing list