diff options
author | Paul Phillips <paulp@improving.org> | 2009-12-15 14:23:33 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-12-15 14:23:33 +0000 |
commit | e59e58b003569be13033d84af38acc7ab6d69139 (patch) | |
tree | 5c01cdf4ac85d9a0bce6aa089dca06bb7009de52 /src/actors/scala/actors/Future.scala | |
parent | 8a89b68903d77b44471fa216561488efbf16bed7 (diff) | |
download | scala-e59e58b003569be13033d84af38acc7ab6d69139.tar.gz scala-e59e58b003569be13033d84af38acc7ab6d69139.tar.bz2 scala-e59e58b003569be13033d84af38acc7ab6d69139.zip |
Eliminating the deprecation warnings in the act...
Eliminating the deprecation warnings in the actor library.
Diffstat (limited to 'src/actors/scala/actors/Future.scala')
-rw-r--r-- | src/actors/scala/actors/Future.scala | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index f194ac57df..d6dba36321 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -27,8 +27,14 @@ import scheduler.DefaultThreadPoolScheduler * @author Philipp Haller */ abstract class Future[+T](val inputChannel: InputChannel[T]) extends Responder[T] with Function0[T] { + private[actors] var fvalue: Option[Any] = None + private[actors] def fvalueTyped = fvalue.get.asInstanceOf[T] + + @deprecated("this member is going to be removed in a future release") + protected def value: Option[Any] = fvalue @deprecated("this member is going to be removed in a future release") - protected var value: Option[Any] = None + protected def value_=(x: Option[Any]) { fvalue = x } + def isSet: Boolean } @@ -145,19 +151,19 @@ object Futures { private[actors] def fromInputChannel[T](inputChannel: InputChannel[T]): Future[T] = new Future[T](inputChannel) { def apply() = - if (isSet) value.get.asInstanceOf[T] + if (isSet) fvalueTyped else inputChannel.receive { - case any => value = Some(any); value.get.asInstanceOf[T] + case any => fvalue = Some(any); fvalueTyped } def respond(k: T => Unit): Unit = - if (isSet) k(value.get.asInstanceOf[T]) + if (isSet) k(fvalueTyped) else inputChannel.react { - case any => value = Some(any); k(value.get.asInstanceOf[T]) + case any => fvalue = Some(any); k(fvalueTyped) } - def isSet = value match { + def isSet = fvalue match { case None => inputChannel.receiveWithin(0) { case TIMEOUT => false - case any => value = Some(any); true + case any => fvalue = Some(any); true } case Some(_) => true } |