Skip to content

Commit

Permalink
Merge pull request #2947 from jglick/Queue-opt
Browse files Browse the repository at this point in the history
[JENKINS-45553] Avoid calling Task.getFullDisplayName unless and until we need to
  • Loading branch information
oleg-nenashev committed Jul 30, 2017
2 parents 4df5895 + 2d65333 commit 378199f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/src/main/java/hudson/model/Queue.java
Expand Up @@ -1540,7 +1540,7 @@ public void maintain() {
continue;
}

String taskDisplayName = p.task.getFullDisplayName();
String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null;

if (p.task instanceof FlyweightTask) {
Runnable r = makeFlyWeightTaskBuildable(new BuildableItem(p));
Expand Down Expand Up @@ -1617,7 +1617,7 @@ public void maintain() {
*/
private @CheckForNull Runnable makeBuildable(final BuildableItem p) {
if (p.task instanceof FlyweightTask) {
String taskDisplayName = p.task.getFullDisplayName();
String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null;
if (!isBlockedByShutdown(p.task)) {

Runnable runnable = makeFlyWeightTaskBuildable(p);
Expand Down Expand Up @@ -1665,7 +1665,8 @@ private Runnable makeFlyWeightTaskBuildable(final BuildableItem p){
hash.addAll(hashSource);

Label lbl = p.getAssignedLabel();
for (Node n : hash.list(p.task.getFullDisplayName())) {
String fullDisplayName = p.task.getFullDisplayName();
for (Node n : hash.list(fullDisplayName)) {
final Computer c = n.toComputer();
if (c == null || c.isOffline()) {
continue;
Expand All @@ -1677,7 +1678,7 @@ private Runnable makeFlyWeightTaskBuildable(final BuildableItem p){
continue;
}

LOGGER.log(Level.FINEST, "Creating flyweight task {0} for computer {1}", new Object[]{p.task.getFullDisplayName(), c.getName()});
LOGGER.log(Level.FINEST, "Creating flyweight task {0} for computer {1}", new Object[]{fullDisplayName, c.getName()});
return new Runnable() {
@Override public void run() {
c.startFlyWeightTask(new WorkUnitContext(p).createWorkUnit(p.task));
Expand Down

0 comments on commit 378199f

Please sign in to comment.