Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9264#discussion_r44856621
--- Diff: core/src/main/scala/org/apache/spark/FutureAction.scala ---
@@ -177,80 +150,50 @@ class SimpleFutureAction[T] private[spark](jobWaiter:
JobWaiter[_], resultFunc:
* takeSample. Cancellation works by setting the cancelled flag to true
and interrupting the
* action thread if it is being blocked by a job.
*/
+@DeveloperApi
class ComplexFutureAction[T] extends FutureAction[T] {
- // Pointer to the thread that is executing the action. It is set when
the action is run.
- @volatile private var thread: Thread = _
+ @volatile private var _cancelled = false
- // A flag indicating whether the future has been cancelled. This is used
in case the future
- // is cancelled before the action was even run (and thus we have no
thread to interrupt).
- @volatile private var _cancelled: Boolean = false
-
- @volatile private var jobs: Seq[Int] = Nil
+ @volatile private var subActions: List[FutureAction[_]] = Nil
// A promise used to signal the future.
- private val p = promise[T]()
+ private val p = Promise[T]()
- override def cancel(): Unit = this.synchronized {
+ override def cancel(): Unit = synchronized {
_cancelled = true
- if (thread != null) {
- thread.interrupt()
- }
+ p.tryFailure(new SparkException("Action has been cancelled"))
+ subActions.foreach {_.cancel()}
--- End diff --
Same, I find braces without a block that needs them a little suboptimal,
but it's trivial
---
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]