Improve scaladoc comments for the task cancellation api.

This commit is contained in:
Josh Suereth 2014-04-08 11:09:23 -04:00
parent 171eb19b96
commit 8f1ef5395d
1 changed files with 19 additions and 5 deletions

View File

@ -19,20 +19,34 @@ final case class EvaluateConfig(cancelable: Boolean, restrictions: Seq[Tags.Rule
/** Represents something that can be cancelled. */
/** Represents something that can be cancelled.
* For example, this is implemented by the TaskEngine; invoking `cancel()` allows you
* to cancel the current task exeuction. A `TaskCancel` is passed to the
* [[TaskEvalautionCancelHandler]] which is responsible for calling `cancel()` when
* appropriate.
*/
trait TaskCancel {
/** cancels whatever this points at. */
def cancel(): Unit
}
/** A handler for registering/remmoving listeners that allow you to cancel tasks. */
/**
* A handler for registering/remmoving listeners that allow you to cancel task
* execution.
*
* Implementations of this trait determine what will trigger `cancel()` for
* the task engine, providing in the `start` method.
*/
trait TaskEvaluationCancelHandler {
/* Evaluation is starting, here's a mechanism to cancel things. */
/** Called when task evaluation starts.
*
* @param canceller An object that can cancel the current task evaluation session.
*/
def start(canceller: TaskCancel): Unit
/* Task Evaluation is complete, whether success or failure. */
/** Called when task evaluation completes, either in success or failure. */
def finish(): Unit
}
object TaskEvaluationCancelHandler {
/** An empty handler that does nothing. */
/** An empty handler that does not cancel tasks. */
object Null extends TaskEvaluationCancelHandler {
def start(canceller: TaskCancel): Unit = ()
def finish(): Unit = ()