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

    https://github.com/apache/spark/pull/14710#discussion_r76347979
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/client/StandaloneAppClient.scala ---
    @@ -220,19 +225,13 @@ private[spark] class StandaloneAppClient(
             endpointRef: RpcEndpointRef,
             context: RpcCallContext,
             msg: T): Unit = {
    -      // Create a thread to ask a message and reply with the result.  
Allow thread to be
    +      // Ask a message and create a thread to reply with the result.  
Allow thread to be
           // interrupted during shutdown, otherwise context must be notified 
of NonFatal errors.
    -      askAndReplyThreadPool.execute(new Runnable {
    -        override def run(): Unit = {
    -          try {
    -            context.reply(endpointRef.askWithRetry[Boolean](msg))
    -          } catch {
    -            case ie: InterruptedException => // Cancelled
    -            case NonFatal(t) =>
    -              context.sendFailure(t)
    -          }
    -        }
    -      })
    +      endpointRef.ask[Boolean](msg).andThen {
    +        case Success(b) => context.reply(b)
    +        case Failure(ie: InterruptedException) => // Cancelled
    +        case Failure(NonFatal(t)) => context.sendFailure(t)
    +      }(askAndReplyExecutionContext)
    --- End diff --
    
    Do you need `askAndReplyExecutionContext` anymore? It seems now all the 
heavy lifting is being done in the RPC thread pool, and the `andThen` code 
could just use `ThreadUtils.sameThreadExecutionContext` since it doesn't do 
much.


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

Reply via email to