[Swift-devel] Re: some racelike condition on file stagein
Ben Clifford
benc at hawaga.org.uk
Wed Feb 27 08:07:19 CST 2008
File.mkdirs() is not thread-safe, according to typing "threadsafe java
mkdirs" into google.
I applied the below patch to my cog checkout and the error goes away for
me. However, I'm not a cog developer, so someone else needs to fix this in
the CoG SVN.
Index: cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java
===================================================================
--- cog.orig/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java 2007-08-27 09:30:23.000000000 +0100
+++ cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java 2008-02-27 13:51:42.000000000 +0000
@@ -146,15 +146,19 @@
}
}
+static Object mkdirlock = new Object();
+
public void createDirectories(String directory)
throws FileResourceException {
if (directory == null || directory.equals("")) {
return;
}
File f = resolve(directory);
+ synchronized(mkdirlock) {
if (!f.mkdirs() && !f.exists()) {
throw new FileResourceException("Failed to create directory: " + directory);
}
+ }
}
public void deleteDirectory(String dir, boolean force) throws FileResourceException {
More information about the Swift-devel
mailing list