mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-15 13:02:19 +00:00
Logging improvements to Run related classes (#8777)
Logging improvements to Run related classes
This commit is contained in:
1 parent
2239347454
commit
302e6ac2d1
3 files changed
+15
-3
No files matched your search
@@ -2480,10 +2480,12 @@ public abstract class Run<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
}
|
||||
Jenkins j = Jenkins.getInstanceOrNull();
|
||||
if (j == null) {
|
||||
LOGGER.fine(() -> "Jenkins not running");
|
||||
return null;
|
||||
}
|
||||
Job<?, ?> job = j.getItemByFullName(jobName, Job.class);
|
||||
if (job == null) {
|
||||
LOGGER.fine(() -> "no such job " + jobName + " when running as " + Jenkins.getAuthentication2().getName());
|
||||
return null;
|
||||
}
|
||||
return job.getBuildByNumber(number);
|
||||
|
||||
@@ -239,6 +239,7 @@ public final class RunMap<R extends Run<?, R>> extends AbstractLazyLoadRunMap<R>
|
||||
LOGGER.log(Level.WARNING, "could not load " + d, e);
|
||||
}
|
||||
}
|
||||
LOGGER.fine(() -> "no config.xml in " + d);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -518,15 +518,21 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer, R>
|
||||
Index snapshot = index;
|
||||
if (snapshot.byNumber.containsKey(n)) {
|
||||
BuildReference<R> ref = snapshot.byNumber.get(n);
|
||||
if (ref == null) return null; // known failure
|
||||
if (ref == null) {
|
||||
LOGGER.fine(() -> "known failure of #" + n + " in " + dir);
|
||||
return null;
|
||||
}
|
||||
R v = unwrap(ref);
|
||||
if (v != null) return v; // already in memory
|
||||
if (v != null) {
|
||||
return v; // already in memory
|
||||
}
|
||||
// otherwise fall through to load
|
||||
}
|
||||
synchronized (this) {
|
||||
if (index.byNumber.containsKey(n)) { // JENKINS-22767: recheck inside lock
|
||||
BuildReference<R> ref = index.byNumber.get(n);
|
||||
if (ref == null) {
|
||||
LOGGER.fine(() -> "known failure of #" + n + " in " + dir);
|
||||
return null;
|
||||
}
|
||||
R v = unwrap(ref);
|
||||
@@ -655,7 +661,10 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer, R>
|
||||
assert Thread.holdsLock(this);
|
||||
try {
|
||||
R r = retrieve(dataDir);
|
||||
if (r == null) return null;
|
||||
if (r == null) {
|
||||
LOGGER.fine(() -> "nothing in " + dataDir);
|
||||
return null;
|
||||
}
|
||||
|
||||
Index copy = editInPlace != null ? editInPlace : new Index(index);
|
||||
|
||||
|
||||
Reference in new issue
Block a user