diff options
author | Philipp Haller <hallerp@gmail.com> | 2006-07-17 08:52:35 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2006-07-17 08:52:35 +0000 |
commit | a39f873983ee688c2f098d2dad3139017ab02832 (patch) | |
tree | eddbc35a15c4c896e32bab8680a52040f8a4ab48 /src | |
parent | 71158d0b5996f966b271986918a27ba8aab9dc37 (diff) | |
download | scala-a39f873983ee688c2f098d2dad3139017ab02832.tar.gz scala-a39f873983ee688c2f098d2dad3139017ab02832.tar.bz2 scala-a39f873983ee688c2f098d2dad3139017ab02832.zip |
Parameterized Actor[T].
Diffstat (limited to 'src')
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/Process.scala | 2 | ||||
-rw-r--r-- | src/actors/scala/actors/distributed/NetKernel.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/distributed/RemoteActor.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/distributed/RemotePid.scala | 2 | ||||
-rw-r--r-- | src/actors/scala/actors/gui/Publisher.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/multi/Actor.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/multi/MailBox.scala | 2 | ||||
-rw-r--r-- | src/actors/scala/actors/multi/Process.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/multi/Scheduler.scala | 1 | ||||
-rw-r--r-- | src/actors/scala/actors/multi/TimerThread.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/single/Actor.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/single/Process.scala | 2 |
13 files changed, 20 insertions, 21 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 593681158c..b99f281f3e 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -11,8 +11,8 @@ package scala.actors /** * @author Philipp Haller */ -trait Actor { +trait Actor[T] { def run(): Unit def start(): Unit - def !(msg: Any): Unit + def !(msg: T): Unit } diff --git a/src/actors/scala/actors/Process.scala b/src/actors/scala/actors/Process.scala index e79e2e2730..1f80da6218 100644 --- a/src/actors/scala/actors/Process.scala +++ b/src/actors/scala/actors/Process.scala @@ -11,7 +11,7 @@ package scala.actors /** * @author Philipp Haller */ -trait Process extends Actor { +trait Process extends Actor[Any] { def link(to: Process): Unit def linkTo(to: Process): Unit def unlink(from: Process): Unit diff --git a/src/actors/scala/actors/distributed/NetKernel.scala b/src/actors/scala/actors/distributed/NetKernel.scala index 8cdc2ffdca..481ce94833 100644 --- a/src/actors/scala/actors/distributed/NetKernel.scala +++ b/src/actors/scala/actors/distributed/NetKernel.scala @@ -108,7 +108,7 @@ class NetKernel(service: Service) { remoteActor } - def localSend(localId: Int, msg: AnyRef): Unit = synchronized { + def localSend(localId: Int, msg: Any): Unit = synchronized { rtable.get(localId) match { case None => error("" + localId + " is not registered at " + this) @@ -118,7 +118,7 @@ class NetKernel(service: Service) { } } - def localSend(pid: RemotePid, msg: AnyRef): Unit = + def localSend(pid: RemotePid, msg: Any): Unit = localSend(pid.localId, msg) def remoteSend(pid: RemotePid, msg: Any) = synchronized { diff --git a/src/actors/scala/actors/distributed/RemoteActor.scala b/src/actors/scala/actors/distributed/RemoteActor.scala index 7920817e95..fc9764f63b 100644 --- a/src/actors/scala/actors/distributed/RemoteActor.scala +++ b/src/actors/scala/actors/distributed/RemoteActor.scala @@ -10,7 +10,7 @@ package scala.actors.distributed -import scala.actors.multi.{MailBox,Process,ExcHandlerDesc} +import scala.actors.multi.{Process,ExcHandlerDesc} import scala.collection.mutable.{HashMap,Stack} abstract class ServiceName @@ -30,7 +30,7 @@ class RemoteActor extends Process { kernel.forwardExc(destDesc, e) } - override def receive(f: PartialFunction[Any,Unit]): scala.All = { + override def receive(f: PartialFunction[Any,Unit]): Nothing = { if (isAlive) { continuation = null sent.dequeueFirst(f.isDefinedAt) match { diff --git a/src/actors/scala/actors/distributed/RemotePid.scala b/src/actors/scala/actors/distributed/RemotePid.scala index a597411dde..a684f6d100 100644 --- a/src/actors/scala/actors/distributed/RemotePid.scala +++ b/src/actors/scala/actors/distributed/RemotePid.scala @@ -10,7 +10,7 @@ package scala.actors.distributed -import scala.actors.multi.{MailBox,ExcHandlerDesc} +import scala.actors.multi.ExcHandlerDesc import java.io._ diff --git a/src/actors/scala/actors/gui/Publisher.scala b/src/actors/scala/actors/gui/Publisher.scala index 38ee6579a0..8577ae60fd 100644 --- a/src/actors/scala/actors/gui/Publisher.scala +++ b/src/actors/scala/actors/gui/Publisher.scala @@ -25,7 +25,7 @@ class EventHandlers { } } -trait Responder extends Actor { +trait Responder extends Actor[Any] { protected val handlers = new EventHandlers final def eventloop(f: PartialFunction[Any,unit]): scala.All = @@ -41,7 +41,7 @@ trait Responder extends Actor { } } - private class RecursiveProxyHandler(a: Actor, f: PartialFunction[Any,unit]) extends PartialFunction[Any,unit] { + private class RecursiveProxyHandler(a: Actor[Any], f: PartialFunction[Any,unit]) extends PartialFunction[Any,unit] { def isDefinedAt(m: Any): boolean = true // events should be removed from the mailbox immediately! diff --git a/src/actors/scala/actors/multi/Actor.scala b/src/actors/scala/actors/multi/Actor.scala index 2b775e927e..626995792f 100644 --- a/src/actors/scala/actors/multi/Actor.scala +++ b/src/actors/scala/actors/multi/Actor.scala @@ -13,7 +13,7 @@ package scala.actors.multi /** * @author Philipp Haller */ -trait Actor extends scala.actors.Actor with MailBox { +trait Actor[T] extends scala.actors.Actor[T] with MailBox { def run(): Unit = {} def start(): Unit = try { run() } @@ -21,5 +21,5 @@ trait Actor extends scala.actors.Actor with MailBox { case d: Done => // do nothing } - def !(msg: Any): Unit = send(msg) + def !(msg: T): Unit = send(msg) } diff --git a/src/actors/scala/actors/multi/MailBox.scala b/src/actors/scala/actors/multi/MailBox.scala index 5ec21e613b..7d6da8924f 100644 --- a/src/actors/scala/actors/multi/MailBox.scala +++ b/src/actors/scala/actors/multi/MailBox.scala @@ -100,7 +100,7 @@ trait MailBox { } } - def receive(f: PartialFunction[Any,unit]): Nothing = { + def receive(f: PartialFunction[Any,Unit]): Nothing = { if (isAlive) { Scheduler.tick(this) continuation = null diff --git a/src/actors/scala/actors/multi/Process.scala b/src/actors/scala/actors/multi/Process.scala index 3764a6454b..5663512f74 100644 --- a/src/actors/scala/actors/multi/Process.scala +++ b/src/actors/scala/actors/multi/Process.scala @@ -72,7 +72,7 @@ object Process { /** * @author Philipp Haller */ -class Process extends scala.actors.Process with Actor { +class Process extends scala.actors.Process with Actor[Any] { private val links = new HashSet[scala.actors.Process] override def start(): Unit = try { run() } @@ -211,7 +211,7 @@ class Process extends scala.actors.Process with Actor { } } - override def receive(f: PartialFunction[Any,unit]): scala.All = { + override def receive(f: PartialFunction[Any,unit]): Nothing = { if (isAlive) { Scheduler.tick(this) continuation = null diff --git a/src/actors/scala/actors/multi/Scheduler.scala b/src/actors/scala/actors/multi/Scheduler.scala index 9deb9c8148..62d4f80cc7 100644 --- a/src/actors/scala/actors/multi/Scheduler.scala +++ b/src/actors/scala/actors/multi/Scheduler.scala @@ -210,7 +210,6 @@ abstract class SpareWorkerScheduler extends IScheduler { } } - /** * @author Philipp Haller */ diff --git a/src/actors/scala/actors/multi/TimerThread.scala b/src/actors/scala/actors/multi/TimerThread.scala index 2b91ba13ca..fc1c2162da 100644 --- a/src/actors/scala/actors/multi/TimerThread.scala +++ b/src/actors/scala/actors/multi/TimerThread.scala @@ -71,7 +71,7 @@ object TimerThread extends AnyRef with Runnable { lateList = Nil } - def requestSignal(a: multi.Actor, waitMillis: long, reason: String): unit = this.synchronized { + def requestSignal(a: MailBox, waitMillis: long, reason: String): unit = this.synchronized { Console.println("TTTT Actor "+a+" requests Signal in "+waitMillis +" ms for :"+reason) val wakeTime = now + waitMillis if (waitMillis < 0) { @@ -143,7 +143,7 @@ object TimerThreadTest { new Tester (500, "TWO").start } - class Tester (duration : int, name:String) extends multi.Actor { + class Tester (duration : int, name:String) extends multi.Actor[Any] { var i = 0 def loop:unit = { diff --git a/src/actors/scala/actors/single/Actor.scala b/src/actors/scala/actors/single/Actor.scala index fa799db985..b6fe13a7de 100644 --- a/src/actors/scala/actors/single/Actor.scala +++ b/src/actors/scala/actors/single/Actor.scala @@ -13,7 +13,7 @@ package scala.actors.single /** * @author Philipp Haller */ -trait Actor extends scala.actors.Actor with MailBox { +trait Actor[T] extends scala.actors.Actor[T] with MailBox { def run(): Unit = {} def start(): Unit = try { run() } @@ -21,5 +21,5 @@ trait Actor extends scala.actors.Actor with MailBox { case d: Done => // do nothing } - def !(msg: Any): Unit = send(msg) + def !(msg: T): Unit = send(msg) } diff --git a/src/actors/scala/actors/single/Process.scala b/src/actors/scala/actors/single/Process.scala index 3f8e0255bc..641414da12 100644 --- a/src/actors/scala/actors/single/Process.scala +++ b/src/actors/scala/actors/single/Process.scala @@ -15,7 +15,7 @@ import scala.collection.mutable.HashSet /** * @author Philipp Haller */ -class Process extends scala.actors.Process with Actor { +class Process extends scala.actors.Process with Actor[Any] { case class Exit(from: scala.actors.Process, reason: Symbol) private val links = new HashSet[scala.actors.Process] |