You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by jr...@apache.org on 2023/02/13 09:27:20 UTC
[incubator-pekko] branch main updated: remove test file with non Apache license (#171)
This is an automated email from the ASF dual-hosted git repository.
jrudolph pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 651d099700 remove test file with non Apache license (#171)
651d099700 is described below
commit 651d09970092245a2648f55b54dcc390f3da7052
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Mon Feb 13 10:27:15 2023 +0100
remove test file with non Apache license (#171)
---
.../test/scala/org/apache/pekko/actor/Bench.scala | 122 ---------------------
1 file changed, 122 deletions(-)
diff --git a/actor-tests/src/test/scala/org/apache/pekko/actor/Bench.scala b/actor-tests/src/test/scala/org/apache/pekko/actor/Bench.scala
deleted file mode 100644
index 0ed4ac9278..0000000000
--- a/actor-tests/src/test/scala/org/apache/pekko/actor/Bench.scala
+++ /dev/null
@@ -1,122 +0,0 @@
-/* The Computer Language Benchmarks Game
- http://shootout.alioth.debian.org/
- contributed by Julien Gaugaz
- inspired by the version contributed by Yura Taras and modified by Isaac Gouy
- */
-
-package org.apache.pekko.actor
-
-object Chameneos {
-
- sealed trait ChameneosEvent
- final case class Meet(from: ActorRef, colour: Colour) extends ChameneosEvent
- final case class Change(colour: Colour) extends ChameneosEvent
- final case class MeetingCount(count: Int) extends ChameneosEvent
- case object Exit extends ChameneosEvent
-
- abstract sealed class Colour
- case object RED extends Colour
- case object YELLOW extends Colour
- case object BLUE extends Colour
- case object FADED extends Colour
-
- val colours = Array[Colour](BLUE, RED, YELLOW)
-
- var start = 0L
- var end = 0L
-
- class Chameneo(var mall: ActorRef, var colour: Colour, cid: Int) extends Actor {
- var meetings = 0
- mall ! Meet(self, colour)
-
- def receive = {
- case Meet(from, otherColour) =>
- colour = complement(otherColour)
- meetings = meetings + 1
- from ! Change(colour)
- mall ! Meet(self, colour)
-
- case Change(newColour) =>
- colour = newColour
- meetings = meetings + 1
- mall ! Meet(self, colour)
-
- case Exit =>
- colour = FADED
- sender() ! MeetingCount(meetings)
- }
-
- def complement(otherColour: Colour): Colour = colour match {
- case RED =>
- otherColour match {
- case RED => RED
- case YELLOW => BLUE
- case BLUE => YELLOW
- case FADED => FADED
- }
- case YELLOW =>
- otherColour match {
- case RED => BLUE
- case YELLOW => YELLOW
- case BLUE => RED
- case FADED => FADED
- }
- case BLUE =>
- otherColour match {
- case RED => YELLOW
- case YELLOW => RED
- case BLUE => BLUE
- case FADED => FADED
- }
- case FADED => FADED
- }
-
- override def toString = s"$cid($colour)"
- }
-
- class Mall(var n: Int, numChameneos: Int) extends Actor {
- var waitingChameneo: Option[ActorRef] = None
- var sumMeetings = 0
- var numFaded = 0
-
- override def preStart() = {
- for (i <- 0 until numChameneos) context.actorOf(Props(new Chameneo(self, colours(i % 3), i)))
- }
-
- def receive = {
- case MeetingCount(i) =>
- numFaded += 1
- sumMeetings += i
- if (numFaded == numChameneos) {
- Chameneos.end = System.currentTimeMillis
- context.stop(self)
- }
-
- case msg: Meet =>
- if (n > 0) {
- waitingChameneo match {
- case Some(chameneo) =>
- n -= 1
- chameneo ! msg
- waitingChameneo = None
- case None => waitingChameneo = Some(sender())
- }
- } else {
- waitingChameneo.foreach(_ ! Exit)
- sender() ! Exit
- }
- }
- }
-
- def run(): Unit = {
- // System.setProperty("pekko.config", "pekko.conf")
- Chameneos.start = System.currentTimeMillis
- val system = ActorSystem()
- system.actorOf(Props(new Mall(1000000, 4)))
- Thread.sleep(10000)
- println("Elapsed: " + (end - start))
- system.terminate()
- }
-
- def main(args: Array[String]): Unit = run()
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org