You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2007/08/28 17:23:16 UTC

svn commit: r570456 - /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/file/FileCleaner.java

Author: ivaynberg
Date: Tue Aug 28 08:23:15 2007
New Revision: 570456

URL: http://svn.apache.org/viewvc?rev=570456&view=rev
Log:
kill the ripper thread if webapp is going down

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/file/FileCleaner.java

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/file/FileCleaner.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/file/FileCleaner.java?rev=570456&r1=570455&r2=570456&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/file/FileCleaner.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/file/FileCleaner.java Tue Aug 28 08:23:15 2007
@@ -23,8 +23,8 @@
 import java.util.Vector;
 
 /**
- * Keeps track of files awaiting deletion, and deletes them when an associated marker
- * object is reclaimed by the garbage collector.
+ * Keeps track of files awaiting deletion, and deletes them when an associated marker object is
+ * reclaimed by the garbage collector.
  * 
  * @author Noel Bergman
  * @author Martin Cooper
@@ -47,8 +47,8 @@
 	private static Thread reaper = new Thread("File Reaper")
 	{
 		/**
-		 * Run the reaper thread that will delete files as their associated marker objects
-		 * are reclaimed by the garbage collector.
+		 * Run the reaper thread that will delete files as their associated marker objects are
+		 * reclaimed by the garbage collector.
 		 */
 		public void run()
 		{
@@ -60,6 +60,10 @@
 					// Wait for a tracker to remove.
 					tracker = (Tracker)q.remove();
 				}
+				catch (InterruptedException e)
+				{
+					break;
+				}
 				catch (Exception e)
 				{
 					continue;
@@ -90,16 +94,19 @@
 		if (reaper != null)
 		{
 			reaper.interrupt();
-			
+
 			// TODO Do we need to manually remove the temp files now?
 		}
 	}
-	
+
 	/**
-	 * Track the specified file, using the provided marker, deleting the file when the
-	 * marker instance is garbage collected.
-	 * @param file The file to be tracked.
-	 * @param marker The marker object used to track the file.
+	 * Track the specified file, using the provided marker, deleting the file when the marker
+	 * instance is garbage collected.
+	 * 
+	 * @param file
+	 *            The file to be tracked.
+	 * @param marker
+	 *            The marker object used to track the file.
 	 */
 	public static void track(File file, Object marker)
 	{
@@ -107,10 +114,13 @@
 	}
 
 	/**
-	 * Track the specified file, using the provided marker, deleting the file when the
-	 * marker instance is garbage collected.
-	 * @param path The full path to the file to be tracked.
-	 * @param marker The marker object used to track the file.
+	 * Track the specified file, using the provided marker, deleting the file when the marker
+	 * instance is garbage collected.
+	 * 
+	 * @param path
+	 *            The full path to the file to be tracked.
+	 * @param marker
+	 *            The marker object used to track the file.
 	 */
 	public static void track(String path, Object marker)
 	{
@@ -118,8 +128,8 @@
 	}
 
 	/**
-	 * Retrieve the number of files currently being tracked, and therefore awaiting
-	 * deletion.
+	 * Retrieve the number of files currently being tracked, and therefore awaiting deletion.
+	 * 
 	 * @return the number of files being tracked.
 	 */
 	public static int getTrackCount()
@@ -140,9 +150,13 @@
 
 		/**
 		 * Constructs an instance of this class from the supplied parameters.
-		 * @param file The file to be tracked.
-		 * @param marker The marker object used to track the file.
-		 * @param queue The queue on to which the tracker will be pushed.
+		 * 
+		 * @param file
+		 *            The file to be tracked.
+		 * @param marker
+		 *            The marker object used to track the file.
+		 * @param queue
+		 *            The queue on to which the tracker will be pushed.
 		 */
 		public Tracker(File file, Object marker, ReferenceQueue queue)
 		{
@@ -151,9 +165,13 @@
 
 		/**
 		 * Constructs an instance of this class from the supplied parameters.
-		 * @param path The full path to the file to be tracked.
-		 * @param marker The marker object used to track the file.
-		 * @param queue The queue on to which the tracker will be pushed.
+		 * 
+		 * @param path
+		 *            The full path to the file to be tracked.
+		 * @param marker
+		 *            The marker object used to track the file.
+		 * @param queue
+		 *            The queue on to which the tracker will be pushed.
 		 */
 		public Tracker(String path, Object marker, ReferenceQueue queue)
 		{
@@ -163,8 +181,9 @@
 
 		/**
 		 * Deletes the file associated with this tracker instance.
-		 * @return <code>true</code> if the file was deleted successfully;
-		 *         <code>false</code> otherwise.
+		 * 
+		 * @return <code>true</code> if the file was deleted successfully; <code>false</code>
+		 *         otherwise.
 		 */
 		public boolean delete()
 		{