Skip to content

Commit c15340c

Browse files
authored
[Bug] [zeta] Fix null pointer exception when submitting jobs (#6492)
1 parent 7c0ea2e commit c15340c

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Diff for: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpPostCommandProcessor.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,7 @@ public void handle(HttpPostCommand httpPostCommand) {
100100
private SeaTunnelServer getSeaTunnelServer() {
101101
Map<String, Object> extensionServices =
102102
this.textCommandService.getNode().getNodeExtension().createExtensionServices();
103-
SeaTunnelServer seaTunnelServer =
104-
(SeaTunnelServer) extensionServices.get(Constant.SEATUNNEL_SERVICE_NAME);
105-
if (!seaTunnelServer.isMasterNode()) {
106-
return null;
107-
}
108-
return seaTunnelServer;
103+
return (SeaTunnelServer) extensionServices.get(Constant.SEATUNNEL_SERVICE_NAME);
109104
}
110105

111106
private void handleSubmitJob(HttpPostCommand httpPostCommand, String uri)
@@ -137,7 +132,7 @@ private void handleSubmitJob(HttpPostCommand httpPostCommand, String uri)
137132
: null);
138133
JobImmutableInformation jobImmutableInformation = restJobExecutionEnvironment.build();
139134
Long jobId = jobImmutableInformation.getJobId();
140-
if (seaTunnelServer == null) {
135+
if (!seaTunnelServer.isMasterNode()) {
141136

142137
NodeEngineUtil.sendOperationToMasterNode(
143138
getNode().nodeEngine,
@@ -171,7 +166,7 @@ private void handleStopJob(HttpPostCommand httpPostCommand, String uri) {
171166
}
172167

173168
SeaTunnelServer seaTunnelServer = getSeaTunnelServer();
174-
if (seaTunnelServer == null) {
169+
if (!seaTunnelServer.isMasterNode()) {
175170
if (isStopWithSavePoint) {
176171
NodeEngineUtil.sendOperationToMasterNode(
177172
getNode().nodeEngine, new SavePointJobOperation(jobId))
@@ -183,7 +178,7 @@ private void handleStopJob(HttpPostCommand httpPostCommand, String uri) {
183178
}
184179

185180
} else {
186-
CoordinatorService coordinatorService = getSeaTunnelServer().getCoordinatorService();
181+
CoordinatorService coordinatorService = seaTunnelServer.getCoordinatorService();
187182

188183
if (isStopWithSavePoint) {
189184
coordinatorService.savePoint(jobId);

0 commit comments

Comments
 (0)