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

    https://github.com/apache/spark/pull/11994#discussion_r153110760
  
    --- Diff: core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala 
---
    @@ -195,18 +196,26 @@ private[spark] class MetricsSystem private (
           val classPath = kv._2.getProperty("class")
           if (null != classPath) {
             try {
    -          val sink = Utils.classForName(classPath)
    -            .getConstructor(classOf[Properties], classOf[MetricRegistry], 
classOf[SecurityManager])
    -            .newInstance(kv._2, registry, securityMgr)
    +          val sink = Utils.classForName(classPath).getConstructor(
    +            classOf[Properties], classOf[MetricRegistry], 
classOf[SecurityManager])
    +              .newInstance(kv._2, registry, securityMgr)
               if (kv._1 == "servlet") {
                 metricsServlet = Some(sink.asInstanceOf[MetricsServlet])
               } else {
                 sinks += sink.asInstanceOf[Sink]
               }
             } catch {
    -          case e: Exception =>
    -            logError("Sink class " + classPath + " cannot be instantiated")
    -            throw e
    +          case _: NoSuchMethodException =>
    +            try {
    +              sinks += Utils.classForName(classPath)
    --- End diff --
    
    No, not necessary, `MetricsServlet` is a built-in metrics sink which will 
be explicitly added in the above code.


---

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

Reply via email to