Skip to content
Snippets Groups Projects
Commit 8399ba14 authored by Marcelo Vanzin's avatar Marcelo Vanzin
Browse files

[SPARK-9261] [STREAMING] Avoid calling APIs that expose shaded classes.

Doing this may cause weird errors when tests are run on maven, depending
on the flags used. Instead, expose the needed functionality through methods
that do not expose shaded classes.

Author: Marcelo Vanzin <vanzin@cloudera.com>

Closes #7601 from vanzin/SPARK-9261 and squashes the following commits:

4f64a16 [Marcelo Vanzin] [SPARK-9261] [streaming] Avoid calling APIs that expose shaded classes.
parent 6aceaf3d
No related branches found
No related tags found
No related merge requests found
......@@ -107,6 +107,25 @@ private[spark] abstract class WebUI(
}
}
/**
* Add a handler for static content.
*
* @param resourceBase Root of where to find resources to serve.
* @param path Path in UI where to mount the resources.
*/
def addStaticHandler(resourceBase: String, path: String): Unit = {
attachHandler(JettyUtils.createStaticHandler(resourceBase, path))
}
/**
* Remove a static content handler.
*
* @param path Path in UI to unmount.
*/
def removeStaticHandler(path: String): Unit = {
handlers.find(_.getContextPath() == path).foreach(detachHandler)
}
/** Initialize all components of the server. */
def initialize()
......
......@@ -17,11 +17,9 @@
package org.apache.spark.streaming.ui
import org.eclipse.jetty.servlet.ServletContextHandler
import org.apache.spark.{Logging, SparkException}
import org.apache.spark.streaming.StreamingContext
import org.apache.spark.ui.{JettyUtils, SparkUI, SparkUITab}
import org.apache.spark.ui.{SparkUI, SparkUITab}
import StreamingTab._
......@@ -42,18 +40,14 @@ private[spark] class StreamingTab(val ssc: StreamingContext)
attachPage(new StreamingPage(this))
attachPage(new BatchPage(this))
var staticHandler: ServletContextHandler = null
def attach() {
getSparkUI(ssc).attachTab(this)
staticHandler = JettyUtils.createStaticHandler(STATIC_RESOURCE_DIR, "/static/streaming")
getSparkUI(ssc).attachHandler(staticHandler)
getSparkUI(ssc).addStaticHandler(STATIC_RESOURCE_DIR, "/static/streaming")
}
def detach() {
getSparkUI(ssc).detachTab(this)
getSparkUI(ssc).detachHandler(staticHandler)
staticHandler = null
getSparkUI(ssc).removeStaticHandler("/static/streaming")
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment