Cleanup stdTaskProj

This commit is contained in:
Dale Wijnand 2016-06-18 01:12:59 +02:00
parent 824df04699
commit 168d3aa267
5 changed files with 9 additions and 9 deletions

View File

@ -71,9 +71,9 @@ final case class Info[T](attributes: AttributeMap = AttributeMap.empty, post: T
def description = attributes.get(Description) def description = attributes.get(Description)
def setName(n: String) = set(Name, n) def setName(n: String) = set(Name, n)
def setDescription(d: String) = set(Description, d) def setDescription(d: String) = set(Description, d)
def set[T](key: AttributeKey[T], value: T) = copy(attributes = this.attributes.put(key, value)) def set[A](key: AttributeKey[A], value: A) = copy(attributes = this.attributes.put(key, value))
def get[T](key: AttributeKey[T]) = attributes.get(key) def get[A](key: AttributeKey[A]) = attributes.get(key)
def postTransform[A](f: (T, AttributeMap) => AttributeMap) = copy(post = (t: T) => f(t, post(t))) def postTransform(f: (T, AttributeMap) => AttributeMap) = copy(post = (t: T) => f(t, post(t)))
override def toString = if (attributes.isEmpty) "_" else attributes.toString override def toString = if (attributes.isEmpty) "_" else attributes.toString
} }

View File

@ -65,8 +65,8 @@ sealed trait TaskStreams[Key] {
private[this] def getID(s: Option[String]) = s getOrElse default private[this] def getID(s: Option[String]) = s getOrElse default
} }
sealed trait ManagedStreams[Key] extends TaskStreams[Key] { sealed trait ManagedStreams[Key] extends TaskStreams[Key] {
def open() def open(): Unit
def close() def close(): Unit
def isClosed: Boolean def isClosed: Boolean
} }

View File

@ -132,7 +132,7 @@ trait TaskExtra {
def mapFailure[T](f: Incomplete => T): Task[T] = mapR(f compose failM) def mapFailure[T](f: Incomplete => T): Task[T] = mapR(f compose failM)
def andFinally(fin: => Unit): Task[S] = mapR(x => Result.tryValue[S]({ fin; x })) def andFinally(fin: => Unit): Task[S] = mapR(x => Result.tryValue[S]({ fin; x }))
def doFinally(t: Task[Unit]): Task[S] = flatMapR(x => t.mapR { tx => Result.tryValues[S](tx :: Nil, x) }) def doFinally(t: Task[Unit]): Task[S] = flatMapR(x => t.result.map { tx => Result.tryValues[S](tx :: Nil, x) })
def ||[T >: S](alt: Task[T]): Task[T] = flatMapR { case Value(v) => task(v); case Inc(i) => alt } def ||[T >: S](alt: Task[T]): Task[T] = flatMapR { case Value(v) => task(v); case Inc(i) => alt }
def &&[T](alt: Task[T]): Task[T] = flatMap(_ => alt) def &&[T](alt: Task[T]): Task[T] = flatMap(_ => alt)
} }

View File

@ -34,5 +34,5 @@ object TaskRunnerCircularTest extends Properties("TaskRunner Circular") {
try { tryRun(top, true, workers); false } try { tryRun(top, true, workers); false }
catch { case i: Incomplete => cyclic(i) } catch { case i: Incomplete => cyclic(i) }
} }
def cyclic(i: Incomplete) = Incomplete.allExceptions(i).exists(_.isInstanceOf[Execute[Task]#CyclicException[_]]) def cyclic(i: Incomplete) = Incomplete.allExceptions(i).exists(_.isInstanceOf[Execute[({ type A[_] <: AnyRef})#A]#CyclicException[_]])
} }

View File

@ -15,7 +15,7 @@ import java.util.concurrent.{ CountDownLatch, TimeUnit }
object TaskSerial extends Properties("task serial") { object TaskSerial extends Properties("task serial") {
val checkCycles = true val checkCycles = true
val Timeout = 100 // in milliseconds val Timeout = 100L // in milliseconds
def eval[T](t: Task[T]): T = tryRun(t, checkCycles, limitTotal(MaxWorkers)) def eval[T](t: Task[T]): T = tryRun(t, checkCycles, limitTotal(MaxWorkers))