Skip to content

Commit 55503fe

Browse files
authored
reduce number of calls to FlowNode#getEnclosingId (#883)
1 parent a7adb78 commit 55503fe

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/io/jenkins/plugins/pipelinegraphview/treescanner/NodeRelationshipFinder.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,19 @@ private void handleBlockStart(@NonNull FlowNode node) {
9696
}
9797

9898
private void addSeenNodes(FlowNode node) {
99-
if (!seenChildNodes.containsKey(node.getEnclosingId())) {
100-
seenChildNodes.put(node.getEnclosingId(), new ArrayDeque<>());
99+
String enclosingId = node.getEnclosingId();
100+
if (!seenChildNodes.containsKey(enclosingId)) {
101+
seenChildNodes.put(enclosingId, new ArrayDeque<>());
101102
}
102103
if (isDebugEnabled) {
103-
logger.debug("Adding {} to seenChildNodes {}", node.getId(), node.getEnclosingId());
104+
logger.debug("Adding {} to seenChildNodes {}", node.getId(), enclosingId);
104105
}
105-
seenChildNodes.get(node.getEnclosingId()).push(node);
106+
seenChildNodes.get(enclosingId).push(node);
106107
}
107108

108109
@CheckForNull
109110
private FlowNode getAfterNode(FlowNode node) {
110-
FlowNode after = null;
111+
FlowNode after;
111112
// The after node is the last child of the enclosing node, except for the last node in
112113
// a block, then it's the last node in the enclosing nodes list (likely, this blocks end node).
113114
FlowNode parentStartNode = getFirstEnclosingNode(node);

0 commit comments

Comments
 (0)