Skip to content

Commit cd7e1f6

Browse files
committed
Fine grain synchronization on handlers only for better performance.
1 parent 45f66a4 commit cd7e1f6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

core/src/main/scala/org/apache/spark/deploy/history/HistoryServer.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,20 @@ class HistoryServer(
148148
appId: String,
149149
attemptId: Option[String],
150150
ui: SparkUI,
151-
completed: Boolean): Unit = this.synchronized {
151+
completed: Boolean) {
152152
assert(serverInfo.isDefined, "HistoryServer must be bound before attaching SparkUIs")
153-
ui.getHandlers.foreach(attachHandler)
153+
handlers.synchronized {
154+
ui.getHandlers.foreach(attachHandler)
155+
}
154156
addFilters(ui.getHandlers, conf)
155157
}
156158

157159
/** Detach a reconstructed UI from this server. Only valid after bind(). */
158-
override def detachSparkUI(
159-
appId: String,
160-
attemptId: Option[String],
161-
ui: SparkUI): Unit = this.synchronized {
160+
override def detachSparkUI(appId: String, attemptId: Option[String], ui: SparkUI): Unit = {
162161
assert(serverInfo.isDefined, "HistoryServer must be bound before detaching SparkUIs")
163-
ui.getHandlers.foreach(detachHandler)
162+
handlers.synchronized {
163+
ui.getHandlers.foreach(detachHandler)
164+
}
164165
provider.onUIDetached(appId, attemptId, ui)
165166
}
166167

0 commit comments

Comments
 (0)