From 56be8bbcbccb9abca2a207e6969ed1a2188352b9 Mon Sep 17 00:00:00 2001 From: xiaochen <598457447@qq.com> Date: Mon, 1 Apr 2024 19:16:14 +0800 Subject: [PATCH] Revert "[Improve][Zeta]Optimize the logic of RestHttpGetCommandProcessor#getSeaTunnelServer()" --- .../seatunnel/engine/server/SeaTunnelServer.java | 16 +++++++--------- .../server/rest/RestHttpGetCommandProcessor.java | 6 +++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java index 4e256d2491f..e9dcdca779f 100644 --- a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java +++ b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java @@ -254,15 +254,13 @@ public boolean taskIsEnded(@NonNull TaskGroupLocation taskGroupLocation) { public boolean isMasterNode() { // must retry until the cluster have master node try { - return Boolean.TRUE.equals( - RetryUtils.retryWithException( - () -> nodeEngine.getThisAddress().equals(nodeEngine.getMasterAddress()), - new RetryUtils.RetryMaterial( - Constant.OPERATION_RETRY_TIME, - true, - exception -> - exception instanceof NullPointerException && isRunning, - Constant.OPERATION_RETRY_SLEEP))); + return RetryUtils.retryWithException( + () -> nodeEngine.getThisAddress().equals(nodeEngine.getMasterAddress()), + new RetryUtils.RetryMaterial( + Constant.OPERATION_RETRY_TIME, + true, + exception -> exception instanceof NullPointerException && isRunning, + Constant.OPERATION_RETRY_SLEEP)); } catch (InterruptedException e) { LOGGER.info("master node check interrupted"); return false; diff --git a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java index 33e6627854d..5c79838bf0b 100644 --- a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java +++ b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java @@ -377,7 +377,6 @@ private JsonObject convertToJson(JobInfo jobInfo, long jobId) { SeaTunnelServer seaTunnelServer = getSeaTunnelServer(true); String jobMetrics; JobStatus jobStatus; - ClassLoaderService classLoaderService; if (seaTunnelServer == null) { jobMetrics = (String) @@ -391,14 +390,15 @@ private JsonObject convertToJson(JobInfo jobInfo, long jobId) { getNode().nodeEngine, new GetJobStatusOperation(jobId)) .join()]; - classLoaderService = getSeaTunnelServer(false).getClassLoaderService(); + seaTunnelServer = getSeaTunnelServer(false); } else { jobMetrics = seaTunnelServer.getCoordinatorService().getJobMetrics(jobId).toJsonString(); jobStatus = seaTunnelServer.getCoordinatorService().getJobStatus(jobId); - classLoaderService = seaTunnelServer.getClassLoaderService(); } + + ClassLoaderService classLoaderService = seaTunnelServer.getClassLoaderService(); ClassLoader classLoader = classLoaderService.getClassLoader( jobId, jobImmutableInformation.getPluginJarsUrls());