From 156ddf8033aaea62b9c912ca84ddf0d13722d3c6 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Wed, 31 May 2023 23:33:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(forest):=20=E4=BF=AE=E5=A4=8D=20forest=20?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E5=88=A4=E6=96=AD=20null=20=E5=80=BC?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit forest 创建代理之后调用 hashcode 方法会导致死循环,调用 equals 方法会导致空指针错误 --- .../service/forest/service/YarnClusterService.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/YarnClusterService.java b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/YarnClusterService.java index 5eee7ba..3017f51 100644 --- a/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/YarnClusterService.java +++ b/service-forest/src/main/java/com/lanyuanxiaoyao/service/forest/service/YarnClusterService.java @@ -6,6 +6,7 @@ import com.eshore.odcp.hudi.connector.Constants; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnApplication; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnQueue; import com.lanyuanxiaoyao.service.configuration.entity.yarn.YarnRootQueue; +import java.util.Objects; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Function; @@ -95,8 +96,9 @@ public class YarnClusterService { if (ObjectUtil.isEmpty(clusters)) { return Lists.immutable.empty(); } - return clusters.collect(this::service) - .reject(ObjectUtil::isNull) + return clusters.toList() + .collect(this::service) + .reject(Objects::isNull) .asParallel(EXECUTOR, 1) .flatCollect(getter::apply) .toList() @@ -115,7 +117,7 @@ public class YarnClusterService { public ImmutableList queueList(ImmutableSet clusters) { //noinspection DataFlowIssue - return clusters + return clusters.toList() .select(servicesMap::containsKey) .asParallel(EXECUTOR, 1) .flatCollect(cluster -> service(cluster).queueList()) @@ -130,7 +132,7 @@ public class YarnClusterService { public ImmutableList queueDetail(ImmutableSet clusters, String name) { //noinspection DataFlowIssue - return clusters + return clusters.toList() .select(servicesMap::containsKey) .asParallel(EXECUTOR, 1) .collect(cluster -> service(cluster).queueDetail(name)) @@ -145,7 +147,7 @@ public class YarnClusterService { public ImmutableList cluster(ImmutableSet clusters) { //noinspection DataFlowIssue - return clusters + return clusters.toList() .select(servicesMap::containsKey) .asParallel(EXECUTOR, 1) .collect(cluster -> service(cluster).cluster())