add wait process terminate Runnable

This commit is contained in:
judy0131 2018-09-17 15:13:36 +08:00
parent e6c4b22e5a
commit 08079e1985
1 changed files with 8 additions and 0 deletions

View File

@ -51,6 +51,7 @@ object API {
val applicationId = spark.sparkContext.applicationId
//process.awaitTermination();
//spark.close();
new Thread( new WaitProcessTerminateRunnable(spark, process)).start()
(applicationId,process)
}
@ -89,3 +90,10 @@ object API {
}
}
class WaitProcessTerminateRunnable(spark : SparkSession, process: Process) extends Runnable {
override def run(): Unit = {
process.awaitTermination()
spark.close()
}
}