Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2489,8 +2489,10 @@ private[spark] class CallerContext(
def setCurrentContext(): Boolean = {
var succeed = false
try {
val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
// scalastyle:off classforname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's important to document why we are not using Utils.classForName here. Otherwise somebody is going to come in the future and get confused or change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will submit a PR for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rxin I have submitted a PR #15776 for this.

val callerContext = Class.forName("org.apache.hadoop.ipc.CallerContext")
val Builder = Class.forName("org.apache.hadoop.ipc.CallerContext$Builder")
// scalastyle:on classforname
val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
val hdfsContext = Builder.getMethod("build").invoke(builderInst)
callerContext.getMethod("setCurrent", callerContext).invoke(null, hdfsContext)
Expand Down