Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3548#discussion_r21143014
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/client/AppClient.scala ---
    @@ -111,6 +123,20 @@ private[spark] class AppClient(
             case x =>
               throw new SparkException("Invalid spark URL: " + x)
           }
    +      import context.dispatcher
    +      // Cancel any existing heartbeat timer
    +      heartbeatTimer.foreach(_.cancel())
    +      // Start a new master heartbeat timer
    +      heartbeatTimer = Some(
    +        context.system.scheduler.schedule(heartbeatInterval, 
heartbeatInterval) {
    +          if (master != null) {  // guard against race condition while 
switching masters
    --- End diff --
    
    Do you think it would be cleaner to have the timer trigger a self-message 
which triggers the sending of the heartbeat to the driver?  This adds more 
indirection but lets me remove the synchronization / thread-safety stuff.
    
    Akka experts: is that a more idiomatic way of doing this? 


---
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]

Reply via email to