From df0c52e7fd880b30bef3d7a59e0c1d5eb2de76e4 Mon Sep 17 00:00:00 2001 From: APaMio <75126256+APaMio@users.noreply.github.com> Date: Fri, 4 Dec 2020 21:48:01 +0800 Subject: [PATCH] MINOR: a small refactor for LogManage#shutdown (#9680) Reviewers: Chia-Ping Tsai --- core/src/main/scala/kafka/log/LogManager.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/kafka/log/LogManager.scala b/core/src/main/scala/kafka/log/LogManager.scala index 3821ac1a9e997..cd3024634e2b2 100755 --- a/core/src/main/scala/kafka/log/LogManager.scala +++ b/core/src/main/scala/kafka/log/LogManager.scala @@ -479,14 +479,14 @@ class LogManager(logDirs: Seq[File], try { for ((dir, dirJobs) <- jobs) { - val hasErrors = dirJobs.map { future => + val hasErrors = dirJobs.exists { future => Try(future.get) match { case Success(_) => false case Failure(e) => warn(s"There was an error in one of the threads during LogManager shutdown: ${e.getCause}") true } - }.contains(true) + } if (!hasErrors) { val logs = logsInDir(localLogsByDir, dir)