Author: scolebourne
Date: Fri Dec 29 04:11:48 2006
New Revision: 490987
URL: http://svn.apache.org/viewvc?view=rev&rev=490987
Log:
Document synchronization
Modified:
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
Modified:
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java?view=diff&rev=490987&r1=490986&r2=490987
==============================================================================
---
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
(original)
+++
jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileCleaner.java
Fri Dec 29 04:11:48 2006
@@ -49,7 +49,7 @@
/**
* Collection of <code>Tracker</code> instances in existence.
*/
- static Collection /* Tracker */ trackers = new Vector();
+ static Collection /* Tracker */ trackers = new Vector(); // synchronized
/**
* Whether to terminate the thread when the tracking is complete.
*/
@@ -128,6 +128,7 @@
* @param deleteStrategy the strategy to delete the file, null means
normal
*/
private static synchronized void addTracker(String path, Object marker,
FileDeleteStrategy deleteStrategy) {
+ // synchronized block protects reaper
if (exitWhenFinished) {
throw new IllegalStateException("No new trackers can be added once
exitWhenFinished() is called");
}
@@ -171,6 +172,7 @@
* One called, no new objects can be tracked by the file cleaner.
*/
public static synchronized void exitWhenFinished() {
+ // synchronized block protects reaper
exitWhenFinished = true;
if (reaper != null) {
synchronized (reaper) {
@@ -179,7 +181,7 @@
}
}
- // -----------------------------------------------------------------------
+ //-----------------------------------------------------------------------
/**
* The reaper thread.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]