You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2011/11/27 13:03:52 UTC
svn commit: r1206706 -
/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
Author: sebb
Date: Sun Nov 27 12:03:51 2011
New Revision: 1206706
URL: http://svn.apache.org/viewvc?rev=1206706&view=rev
Log:
Document locking
Modified:
jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
Modified: jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java?rev=1206706&r1=1206705&r2=1206706&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/services/FileServer.java Sun Nov 27 12:03:51 2011
@@ -75,7 +75,7 @@ public class FileServer {
//@GuardedBy("this")
private File base;
- //@GuardedBy("this") TODO perhaps use ConcurrentHashMap
+ //@GuardedBy("this") NOTE this also guards against possible window in checkForOpenFiles()
private final Map<String, FileEntry> files = new HashMap<String, FileEntry>();
private static final FileServer server = new FileServer();
@@ -159,13 +159,16 @@ public class FileServer {
}
/**
- * @throws IllegalStateException
+ * Check if there are entries in use.
+ * <p>
+ *
+ * @throws IllegalStateException if there are any entries still in use
*/
private void checkForOpenFiles() throws IllegalStateException {
- if (filesOpen()) {
+ if (filesOpen()) { // checks for entries in use
throw new IllegalStateException("Files are still open, cannot change base directory");
}
- files.clear();
+ files.clear(); // tidy up any unused entries
}
public synchronized String getBaseDir() {