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

    https://github.com/apache/spark/pull/9571#discussion_r45874777
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/HistoryServer.scala ---
    @@ -121,20 +132,36 @@ class HistoryServer(
       /**
        * Initialize the history server.
        *
    -   * This starts a background thread that periodically synchronizes 
information displayed on
    -   * this UI with the event logs in the provided base directory.
    +   * This calls [[ApplicationHistoryProvider.start()]] to start the 
history provider.
        */
       def initialize() {
    -    attachPage(new HistoryPage(this))
    -
    -    attachHandler(ApiRootResource.getServletHandler(this))
    -
    -    attachHandler(createStaticHandler(SparkUI.STATIC_RESOURCE_DIR, 
"/static"))
    -
    -    val contextHandler = new ServletContextHandler
    -    contextHandler.setContextPath(HistoryServer.UI_PATH_PREFIX)
    -    contextHandler.addServlet(new ServletHolder(loaderServlet), "/*")
    -    attachHandler(contextHandler)
    +    if (!initialized.getAndSet(true)) {
    +      attachPage(new HistoryPage(this))
    +
    +      attachHandler(ApiRootResource.getServletHandler(this))
    +
    +      attachHandler(createStaticHandler(SparkUI.STATIC_RESOURCE_DIR, 
"/static"))
    +
    +      val contextHandler = new ServletContextHandler
    +      contextHandler.setContextPath(HistoryServer.UI_PATH_PREFIX)
    +      contextHandler.addServlet(new ServletHolder(loaderServlet), "/*")
    +      attachHandler(contextHandler)
    +
    +      // hook up Codahale metrics
    +      val metricsHandler = new ServletContextHandler(null, 
HistoryServer.METRICS_PATH_PREFIX)
    +      metricsHandler.addServlet(new ServletHolder(new 
HealthCheckServlet(health)),
    --- End diff --
    
    given the repetition here, this could take a list of (servlet, path) and 
apply that to the registration


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