diff options
Diffstat (limited to 'src/actors')
-rw-r--r-- | src/actors/scala/actors/Channel.scala | 13 | ||||
-rw-r--r-- | src/actors/scala/actors/OutputChannel.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/ReplyableReactor.scala | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala index 93525dddbd..b8c0420372 100644 --- a/src/actors/scala/actors/Channel.scala +++ b/src/actors/scala/actors/Channel.scala @@ -38,9 +38,9 @@ case class ! [a](ch: Channel[a], msg: a) * @version 0.9.17 * @author Philipp Haller */ -class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputChannel[Msg] { +class Channel[Msg](val receiver: Reactor) extends InputChannel[Msg] with OutputChannel[Msg] { - def this() = this(Actor.self) + def this() = this(Actor.rawSelf) /** * Sends a message to this <code>Channel</code>. @@ -78,7 +78,8 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha */ def receive[R](f: PartialFunction[Msg, R]): R = { val C = this.asInstanceOf[Channel[Any]] - receiver.receive { + val recvActor = receiver.asInstanceOf[Actor] + recvActor.receive { case C ! msg if (f.isDefinedAt(msg.asInstanceOf[Msg])) => f(msg.asInstanceOf[Msg]) } } @@ -100,7 +101,8 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha */ def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = { val C = this.asInstanceOf[Channel[Any]] - receiver.receiveWithin(msec) { + val recvActor = receiver.asInstanceOf[Actor] + recvActor.receiveWithin(msec) { case C ! msg if (f.isDefinedAt(msg)) => f(msg) case TIMEOUT => f(TIMEOUT) } @@ -133,7 +135,8 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha */ def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = { val C = this.asInstanceOf[Channel[Any]] - receiver.reactWithin(msec) { + val recvActor = receiver.asInstanceOf[Actor] + recvActor.reactWithin(msec) { case C ! msg if (f.isDefinedAt(msg)) => f(msg) case TIMEOUT => f(TIMEOUT) } diff --git a/src/actors/scala/actors/OutputChannel.scala b/src/actors/scala/actors/OutputChannel.scala index 92c42282d9..261ef56359 100644 --- a/src/actors/scala/actors/OutputChannel.scala +++ b/src/actors/scala/actors/OutputChannel.scala @@ -42,8 +42,8 @@ trait OutputChannel[-Msg] { def forward(msg: Msg): Unit /** - * Returns the <code>Actor</code> that is + * Returns the <code>Reactor</code> that is * receiving from this <code>OutputChannel</code>. */ - def receiver: Actor + def receiver: Reactor } diff --git a/src/actors/scala/actors/ReplyableReactor.scala b/src/actors/scala/actors/ReplyableReactor.scala index 221b424c2c..1f7c774f4a 100644 --- a/src/actors/scala/actors/ReplyableReactor.scala +++ b/src/actors/scala/actors/ReplyableReactor.scala @@ -58,7 +58,7 @@ trait ReplyableReactor extends Replyable[Any, Any] { * returns a future representing the reply value. */ def !!(msg: Any): Future[Any] = { - val ftch = new Channel[Any](Actor.self(thiz.scheduler)) + val ftch = new Channel[Any](Actor.rawSelf(thiz.scheduler)) thiz.send(msg, ftch) Futures.fromInputChannel(ftch) } @@ -71,7 +71,7 @@ trait ReplyableReactor extends Replyable[Any, Any] { * precise type for the reply value. */ def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = { - val ftch = new Channel[A](Actor.self(thiz.scheduler)) + val ftch = new Channel[A](Actor.rawSelf(thiz.scheduler)) thiz.send(msg, new OutputChannel[Any] { def !(msg: Any) = ftch ! f(msg) |