diff options
author | Philipp Haller <hallerp@gmail.com> | 2006-06-21 11:35:37 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2006-06-21 11:35:37 +0000 |
commit | 3fe40a93ffda8571721ff574469171c633191fc4 (patch) | |
tree | afce1c862f9f24d3d456a31edd1c1b0c59b7663b /docs/examples/actors | |
parent | fe052478812dc753292c5efc3ac5e32df09a1808 (diff) | |
download | scala-3fe40a93ffda8571721ff574469171c633191fc4.tar.gz scala-3fe40a93ffda8571721ff574469171c633191fc4.tar.bz2 scala-3fe40a93ffda8571721ff574469171c633191fc4.zip |
Diffstat (limited to 'docs/examples/actors')
-rw-r--r-- | docs/examples/actors/counter/CounterMessages.scala | 8 | ||||
-rw-r--r-- | docs/examples/actors/counter/CounterUserTcp.scala | 38 | ||||
-rw-r--r-- | docs/examples/actors/counter/RemoteCounter.scala | 21 |
3 files changed, 0 insertions, 67 deletions
diff --git a/docs/examples/actors/counter/CounterMessages.scala b/docs/examples/actors/counter/CounterMessages.scala deleted file mode 100644 index 6bacac0ad9..0000000000 --- a/docs/examples/actors/counter/CounterMessages.scala +++ /dev/null @@ -1,8 +0,0 @@ -package actors.examples.counter - -import actors.multi.Pid - -abstract class CounterMessage -case class Incr() extends CounterMessage -case class Value(p: Pid) extends CounterMessage -case class Result(v: int) extends CounterMessage diff --git a/docs/examples/actors/counter/CounterUserTcp.scala b/docs/examples/actors/counter/CounterUserTcp.scala deleted file mode 100644 index b6c304bb1c..0000000000 --- a/docs/examples/actors/counter/CounterUserTcp.scala +++ /dev/null @@ -1,38 +0,0 @@ -package actors.examples.counter - -import actors.multi.Pid -import actors.distributed.RemoteActor -import actors.distributed.TCP -import actors.distributed.TcpNode -import actors.distributed.TcpService - -class CounterUser extends RemoteActor { - override def run(): unit = { - alive(TCP()) - - spawn(TcpNode("127.0.0.1", 9090), "actors.examples.counter.Counter") - - receive { - case p: Pid => - // communicate with counter - Console.println("" + node + ": Sending Incr() to remote Counter (" + p + ")...") - p ! Incr() - p ! Incr() - p ! Value(self) - receive { - case Result(v) => - Console.println("Received result: " + v) - } - } - } -} - -object Main { - def main(args: Array[String]): unit = { - val serv = new TcpService(9090) - serv.start() - - val cu = new CounterUser - cu.start() - } -} diff --git a/docs/examples/actors/counter/RemoteCounter.scala b/docs/examples/actors/counter/RemoteCounter.scala deleted file mode 100644 index 1f5c730a1a..0000000000 --- a/docs/examples/actors/counter/RemoteCounter.scala +++ /dev/null @@ -1,21 +0,0 @@ -package actors.examples.counter - -import actors.distributed.RemoteActor - -class Counter extends RemoteActor { - override def run(): unit = - loop(0) - - def loop(value: int): unit = { - Console.println("Value: " + value) - receive { - case Incr() => - loop(value + 1) - case Value(p) => - p ! Result(value) - loop(value) - case other => - loop(value) - } - } -} |