提交 e987d270 编写于 作者: K kohsuke

It's not obvious to me if the race condition could ever occur, but Rama and I...

It's not obvious to me if the race condition could ever occur, but Rama and I experienced a very suspicious failure once, and we are hoping that this would fix it.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9018 71c3de6d-444a-0410-be80-ed276b4c234a
上级 7f0bb9c7
...@@ -357,9 +357,19 @@ public final class FilePath implements Serializable { ...@@ -357,9 +357,19 @@ public final class FilePath implements Serializable {
* Creates this directory. * Creates this directory.
*/ */
public void mkdirs() throws IOException, InterruptedException { public void mkdirs() throws IOException, InterruptedException {
if(act(new FileCallable<Boolean>() { if(!act(new FileCallable<Boolean>() {
public Boolean invoke(File f, VirtualChannel channel) throws IOException { public Boolean invoke(File f, VirtualChannel channel) throws IOException {
return !f.mkdirs() && !f.exists(); if(f.mkdirs() || f.exists())
return true; // OK
// following Ant <mkdir> task to avoid possible race condition.
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// ignore
}
return f.mkdirs() || f.exists();
} }
})) }))
throw new IOException("Failed to mkdirs: "+remote); throw new IOException("Failed to mkdirs: "+remote);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册