2828import java .util .Set ;
2929
3030/**
31- * Keeps track of files awaiting deletion, and deletes them when an associated
31+ * Tracks files awaiting deletion, and deletes them when an associated
3232 * marker object is reclaimed by the garbage collector.
3333 * <p>
3434 * This utility creates a background thread to handle file deletion.
@@ -76,6 +76,7 @@ public void run() {
7676 }
7777 tracker .clear ();
7878 } catch (final InterruptedException e ) {
79+ // interrupted removing from the queue.
7980 interrupt ();
8081 continue ;
8182 }
@@ -172,9 +173,8 @@ public FileCleaningTracker() {
172173 * @param deleteStrategy the strategy to delete the file, null means normal.
173174 * @throws NullPointerException Thrown if the path is null.
174175 */
175- private synchronized void addTracker (final String path , final Object marker , final FileDeleteStrategy
176- deleteStrategy ) {
177- // synchronized block protects reaper
176+ private synchronized void addTracker (final String path , final Object marker , final FileDeleteStrategy deleteStrategy ) {
177+ // synchronized method guards reaper
178178 if (exitWhenFinished ) {
179179 throw new IllegalStateException ("No new trackers can be added once exitWhenFinished() is called" );
180180 }
@@ -194,21 +194,24 @@ private synchronized void addTracker(final String path, final Object marker, fin
194194 * with multiple class loaders (such as an application server), you should be
195195 * aware that the file cleaner thread will continue running even if the class
196196 * loader it was started from terminates. This can constitute a memory leak.
197+ * </p>
197198 * <p>
198199 * For example, suppose that you have developed a web application, which
199200 * contains the commons-io jar file in your WEB-INF/lib directory. In other
200201 * words, the FileCleaner class is loaded through the class loader of your
201202 * web application. If the web application is terminated, but the servlet
202203 * container is still running, then the file cleaner thread will still exist,
203204 * posing a memory leak.
205+ * </p>
204206 * <p>
205207 * This method allows the thread to be terminated. Simply call this method
206208 * in the resource cleanup code, such as
207209 * {@code javax.servlet.ServletContextListener.contextDestroyed(javax.servlet.ServletContextEvent)}.
208210 * Once called, no new objects can be tracked by the file cleaner.
211+ * </p>
209212 */
210213 public synchronized void exitWhenFinished () {
211- // synchronized block protects reaper
214+ // synchronized method guards reaper
212215 exitWhenFinished = true ;
213216 if (reaper != null ) {
214217 synchronized (reaper ) {
0 commit comments