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

    https://github.com/apache/spark/pull/21523#discussion_r194490802
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/WebUI.scala ---
    @@ -91,7 +91,12 @@ private[spark] abstract class WebUI(
       /** Attach a handler to this UI. */
       def attachHandler(handler: ServletContextHandler) {
         handlers += handler
    -    serverInfo.foreach(_.addHandler(handler))
    +    serverInfo.foreach { sInfo =>
    --- End diff --
    
    I have a slight preference for doing this in the `ServerInfo` class, so 
that we're sure we're covering all paths.
    
    I have a WIP patch for another thing where I did that, something like this:
    
    ```
    @@ -507,17 +517,19 @@ private[spark] case class ServerInfo(
         server: Server,
         boundPort: Int,
         securePort: Option[Int],
    +    private val conf: SparkConf,
         private val rootHandler: ContextHandlerCollection) {
     
    -  def addHandler(handler: ContextHandler): Unit = {
    +  def addHandler(handler: ServletContextHandler): Unit = {
         
handler.setVirtualHosts(JettyUtils.toVirtualHosts(JettyUtils.SPARK_CONNECTOR_NAME))
    +    JettyUtils.addFilters(Seq(handler), conf)
         rootHandler.addHandler(handler)
         if (!handler.isStarted()) {
           handler.start()
         }
       }
    ```
    
    It also avoids a race where an already started handler would be added 
before filters are installed. Extremely unlikely that would be a problem, but 
well.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to