Skip to content

Commit

Permalink
Fix SlowBeanDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
ogesaku committed Feb 8, 2024
1 parent 03143b0 commit 3908795
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public void handle(BeanPreCreateEvent event) {
.add(event.bean());
parentDependencies.computeIfAbsent(event.bean(), (k) -> new HashSet<>())
.add(parent);
timers.get(parent).pause();
Timer parentTimer = timers.get(parent);
if (parentTimer != null) {
parentTimer.pause();
}
}
}

Expand All @@ -45,8 +48,9 @@ public void handle(BeanPostCreateEvent event) {
for (BeanDescriptor<?> parent : parentDependencies.getOrDefault(event.bean(), Set.of())) {
Set<BeanDescriptor<?>> children = dependencies.computeIfAbsent(parent, (k) -> new HashSet<>());
children.remove(event.bean());
if (children.isEmpty()) {
timers.get(parent).resume();
Timer parentTimer = timers.get(parent);
if (children.isEmpty() && parentTimer != null) {
parentTimer.resume();
}
}
dependencies.remove(event.bean());
Expand Down

0 comments on commit 3908795

Please sign in to comment.