Skip to content

Commit aa826d7

Browse files
committed
Fix the Spark Job Run config submit button unstopable issue
Signed-off-by: Wei Zhang <[email protected]>
1 parent 51ab69d commit aa826d7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/run/SparkBatchJobRunProcessHandler.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
package com.microsoft.azure.hdinsight.spark.run;
2424

25+
import com.intellij.execution.process.ProcessAdapter;
26+
import com.intellij.execution.process.ProcessEvent;
2527
import com.intellij.remote.ColoredRemoteProcessHandler;
2628
import com.microsoft.azure.hdinsight.common.MessageInfoType;
2729
import org.jetbrains.annotations.NotNull;
@@ -35,6 +37,20 @@ public class SparkBatchJobRunProcessHandler extends ColoredRemoteProcessHandler<
3537
implements SparkBatchJobProcessCtrlLogOut {
3638
public SparkBatchJobRunProcessHandler(@NotNull SparkBatchJobRemoteProcess process, String commandLine, @Nullable Charset charset) {
3739
super(new SparkBatchJobProcessAdapter(process), commandLine, charset);
40+
41+
super.addProcessListener(new ProcessAdapter() {
42+
@Override
43+
public void processWillTerminate(@NotNull ProcessEvent event, boolean willBeDestroyed) {
44+
if (willBeDestroyed) {
45+
// Kill the Spark Batch Job
46+
process.destroy();
47+
} else {
48+
// Just detach
49+
process.disconnect();
50+
}
51+
super.processWillTerminate(event, willBeDestroyed);
52+
}
53+
});
3854
}
3955

4056
@NotNull

0 commit comments

Comments
 (0)