Skip to content

Commit 3f22f21

Browse files
eemhukortemik
andauthored
#794: wrap DPLExecutorImpl.stop() code in streamingQuery null check (#795)
* wrap DPLExecutorImpl.stop() code in streamingQuery null check * make streamingQuery local reference in stop() at DPLExecutorImpl.java --------- Co-authored-by: Mikko Kortelainen <[email protected]>
1 parent 6154410 commit 3f22f21

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/main/java/com/teragrep/pth_10/executor/DPLExecutorImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ private long getQueryTimeout() {
279279

280280
@Override
281281
public void stop() throws TimeoutException {
282-
LOGGER.debug("queryId <{}> Request to stop streaming query", streamingQuery.name());
283-
if (
284-
streamingQuery != null && !streamingQuery.sparkSession().sparkContext().isStopped()
285-
&& streamingQuery.isActive()
286-
) {
287-
LOGGER.info("queryId <{}> Stopping streaming query", streamingQuery.name());
288-
streamingQuery.stop();
282+
final StreamingQuery sq = streamingQuery;
283+
if (sq != null) {
284+
LOGGER.debug("queryId <{}> Request to stop streaming query", sq.name());
285+
if (!sq.sparkSession().sparkContext().isStopped() && sq.isActive()) {
286+
LOGGER.info("queryId <{}> Stopping streaming query", sq.name());
287+
sq.stop();
288+
}
289289
}
290290
}
291291
}

0 commit comments

Comments
 (0)