Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/3868#discussion_r22444597 --- Diff: streaming/src/main/scala/org/apache/spark/streaming/scheduler/ReceiverTracker.scala --- @@ -223,22 +227,40 @@ class ReceiverTracker(ssc: StreamingContext, skipReceiverLaunch: Boolean = false thread.start() } - def stop() { + def stop(graceful: Boolean) { // Send the stop signal to all the receivers stopReceivers() // Wait for the Spark job that runs the receivers to be over // That is, for the receivers to quit gracefully. + val stopTimeout = conf.getLong( + "spark.streaming.gracefulStopTimeout", + 10 * ssc.graph.batchDuration.milliseconds) + + thread.join(10000) // Check if all the receivers have been deregistered or not - if (!receiverInfo.isEmpty) { - logWarning("All of the receivers have not deregistered, " + receiverInfo) + def done = { receiverInfo.isEmpty && terminated } + + if (graceful) { + TimeoutUtils.waitUntilDone(stopTimeout,() => done ) match { --- End diff -- Kind of a toss-up over whether to use `match` vs `if` here, I guess. Matching on a boolean feels a bit strange to me.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org