Github user harishreedharan commented on a diff in the pull request:
https://github.com/apache/spark/pull/6294#discussion_r30917969
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceiverSupervisor.scala
---
@@ -117,11 +117,15 @@ private[streaming] abstract class ReceiverSupervisor(
/** Start receiver */
def startReceiver(): Unit = synchronized {
try {
- logInfo("Starting receiver")
- receiver.onStart()
- logInfo("Called receiver onStart")
- onReceiverStart()
- receiverState = Started
+ if (onReceiverStart()) {
+ logInfo("Starting receiver")
+ receiverState = Started
+ receiver.onStart()
+ logInfo("Called receiver onStart")
+ } else {
+ // The driver refused us
+ stop("Registered unsuccessfully because the driver refused" +
streamId, None)
+ }
} catch {
case t: Throwable =>
--- End diff --
+1. I learnt that the hard way too. See
https://www.sumologic.com/2014/05/05/why-you-should-never-catch-throwable-in-scala/
and
http://www.scala-lang.org/api/current/scala/util/control/ControlThrowable.html
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]