Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/9264#discussion_r44575716
--- Diff: core/src/main/scala/org/apache/spark/scheduler/JobWaiter.scala ---
@@ -49,29 +51,18 @@ private[spark] class JobWaiter[T](
dagScheduler.cancelJob(jobId)
}
- override def taskSucceeded(index: Int, result: Any): Unit = synchronized
{
- if (_jobFinished) {
- throw new UnsupportedOperationException("taskSucceeded() called on a
finished JobWaiter")
- }
- resultHandler(index, result.asInstanceOf[T])
- finishedTasks += 1
- if (finishedTasks == totalTasks) {
- _jobFinished = true
- jobResult = JobSucceeded
- this.notifyAll()
+ override def taskSucceeded(index: Int, result: Any): Unit = {
+ /*
+ The resultHandler call must be synchronized in case resultHandler
itself
+ is not thread safe.
+ */
+ synchronized(resultHandler(index, result.asInstanceOf[T]))
--- End diff --
Elsewhere in Spark we don't do comments or synchronized blocks like this.
Can you follow this style:
```
// The resultHandler call ...
synchronized {
resultHandler(...)
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]