未验证 提交 4c16f2cd 编写于 作者: V Vincent Latombe 提交者: GitHub

Make Computer#getLogDir thread-safe (#4730)

上级 6e11d612
......@@ -195,6 +195,8 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
protected final Object statusChangeLock = new Object();
private final Object logDirLock = new String("logDirLock");
/**
* Keeps track of stack traces to track the termination requests for this computer.
*
......@@ -303,10 +305,12 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
*/
protected @NonNull File getLogDir() {
File dir = new File(Jenkins.get().getRootDir(),"logs/slaves/"+nodeName);
try {
IOUtils.mkdirs(dir);
} catch (IOException x) {
LOGGER.log(Level.SEVERE, "Failed to create agent log directory " + dir, x);
synchronized (logDirLock) {
try {
IOUtils.mkdirs(dir);
} catch (IOException x) {
LOGGER.log(Level.SEVERE, "Failed to create agent log directory " + dir, x);
}
}
return dir;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册