FrankYang0529 commented on PR #16499: URL: https://github.com/apache/kafka/pull/16499#issuecomment-2217772348
> ```java > static DetectThreadLeak of(Predicate<Thread> predicate) { > Set<Long> before = Thread.getAllStackTraces().keySet() > .stream().filter(predicate).map(Thread::getId).collect(Collectors.toSet()); > return () -> Thread.getAllStackTraces().keySet() > .stream().filter(predicate) > .filter(t -> !before.contains(t.getId())) > .collect(Collectors.toList()); > } > ``` Hi @chia7712, thanks for the great suggestion! Yes, with this change, the code is more clear and we don't need `DetectThreadLeakImpl` class. I update the code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org