commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r919676 - /commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java
Date Sat, 06 Mar 2010 00:08:27 GMT
Author: sebb
Date: Sat Mar  6 00:08:27 2010
New Revision: 919676

URL: http://svn.apache.org/viewvc?rev=919676&view=rev
Log:
See IO-159: remove() never returns null

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java?rev=919676&r1=919675&r2=919676&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaningTracker.java Sat Mar
 6 00:08:27 2010
@@ -168,7 +168,7 @@
      * <p>
      * This method allows the thread to be terminated. Simply call this method
      * in the resource cleanup code, such as {@link javax.servlet.ServletContextListener#contextDestroyed}.
-     * One called, no new objects can be tracked by the file cleaner.
+     * Once called, no new objects can be tracked by the file cleaner.
      */
     public synchronized void exitWhenFinished() {
         // synchronized block protects reaper
@@ -200,17 +200,14 @@
         public void run() {
             // thread exits when exitWhenFinished is true and there are no more tracked objects
             while (exitWhenFinished == false || trackers.size() > 0) {
-                Tracker tracker = null;
                 try {
                     // Wait for a tracker to remove.
-                    tracker = (Tracker) q.remove();
-                } catch (Exception e) {
-                    continue;
-                }
-                if (tracker != null) {
+                    Tracker tracker = (Tracker) q.remove(); // cannot return null
                     tracker.delete();
                     tracker.clear();
                     trackers.remove(tracker);
+                } catch (InterruptedException e) {
+                    continue;
                 }
             }
         }



Mime
View raw message