mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-31 21:45:25 +00:00
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
This commit is contained in:
1 parent
7f0bb9c7a6
commit
e987d2709b
1 file changed
+12
-2
@@ -357,9 +357,19 @@ public final class FilePath implements Serializable {
|
||||
* Creates this directory.
|
||||
*/
|
||||
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 {
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user