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: 3 additions & 3 deletions core/src/main/scala/org/apache/spark/BarrierCoordinator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ private[spark] class BarrierCoordinator(
private var timerTask: TimerTask = null

// Init a TimerTask for a barrier() call.
private def initTimerTask(): Unit = {
private def initTimerTask(state: ContextBarrierState): Unit = {
timerTask = new TimerTask {
override def run(): Unit = synchronized {
override def run(): Unit = state.synchronized {
// Timeout current barrier() call, fail all the sync requests.
requesters.foreach(_.sendFailure(new SparkException("The coordinator didn't get all " +
s"barrier sync requests for barrier epoch $barrierEpoch from $barrierId within " +
Expand Down Expand Up @@ -148,7 +148,7 @@ private[spark] class BarrierCoordinator(
// If this is the first sync message received for a barrier() call, start timer to ensure
// we may timeout for the sync.
if (requesters.isEmpty) {
initTimerTask()
initTimerTask(this)
timer.schedule(timerTask, timeoutInSecs * 1000)
}
// Add the requester to array of RPCCallContexts pending for reply.
Expand Down