Permalink
Browse files

Merge branch 'master' into wip-2053d-actorbased-remote-drewhk

  • Loading branch information...
2 parents a0c02c3 + 6a348e3 commit 0f0c5cb17ab28019d5fd9ebb44c6d36af972e972 Endre Sándor Varga committed Nov 21, 2012
Showing with 2,067 additions and 1,085 deletions.
  1. +8 −0 akka-actor-tests/src/test/java/akka/japi/JavaAPITestBase.java
  2. +2 −1 akka-actor-tests/src/test/java/akka/routing/CustomRouteTest.java
  3. +27 −1 akka-actor-tests/src/test/scala/akka/actor/ActorDSLSpec.scala
  4. +4 −7 akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala
  5. +11 −5 akka-actor-tests/src/test/scala/akka/actor/IOActor.scala
  6. +3 −2 akka-actor-tests/src/test/scala/akka/actor/LocalActorRefProviderSpec.scala
  7. +5 −7 akka-actor-tests/src/test/scala/akka/actor/RelativeActorPathSpec.scala
  8. +5 −5 akka-actor-tests/src/test/scala/akka/actor/SupervisorHierarchySpec.scala
  9. +7 −6 akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala
  10. +3 −0 akka-actor-tests/src/test/scala/akka/config/ConfigSpec.scala
  11. +11 −13 akka-actor-tests/src/test/scala/akka/dispatch/PriorityDispatcherSpec.scala
  12. +15 −14 akka-actor-tests/src/test/scala/akka/performance/workbench/BenchResultRepository.scala
  13. +10 −13 akka-actor-tests/src/test/scala/akka/performance/workbench/GoogleChartBuilder.scala
  14. +9 −9 akka-actor-tests/src/test/scala/akka/performance/workbench/Report.scala
  15. +3 −3 akka-actor-tests/src/test/scala/akka/routing/CustomRouteSpec.scala
  16. +3 −4 akka-actor-tests/src/test/scala/akka/routing/ResizerSpec.scala
  17. +34 −33 akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala
  18. +22 −1 akka-actor-tests/src/test/scala/akka/util/DurationSpec.scala
  19. +1 −1 akka-actor/src/main/java/akka/japi/JAPI.java
  20. +16 −6 akka-actor/src/main/java/akka/util/internal/HashedWheelTimer.java
  21. +22 −10 akka-actor/src/main/scala/akka/actor/ActorCell.scala
  22. +12 −13 akka-actor/src/main/scala/akka/actor/ActorPath.scala
  23. +10 −4 akka-actor/src/main/scala/akka/actor/ActorRef.scala
  24. +4 −6 akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala
  25. +10 −14 akka-actor/src/main/scala/akka/actor/ActorSystem.scala
  26. +7 −7 akka-actor/src/main/scala/akka/actor/Address.scala
  27. +4 −3 akka-actor/src/main/scala/akka/actor/Deployer.scala
  28. +5 −5 akka-actor/src/main/scala/akka/actor/DynamicAccess.scala
  29. +1 −1 akka-actor/src/main/scala/akka/actor/Extension.scala
  30. +1 −1 akka-actor/src/main/scala/akka/actor/FSM.scala
  31. +11 −24 akka-actor/src/main/scala/akka/actor/FaultHandling.scala
  32. +10 −9 akka-actor/src/main/scala/akka/actor/IO.scala
  33. +4 −3 akka-actor/src/main/scala/akka/actor/RepointableActorRef.scala
  34. +2 −2 akka-actor/src/main/scala/akka/actor/Scheduler.scala
  35. +2 −2 akka-actor/src/main/scala/akka/actor/Stash.scala
  36. +13 −10 akka-actor/src/main/scala/akka/actor/TypedActor.scala
  37. +11 −2 akka-actor/src/main/scala/akka/actor/dsl/Creators.scala
  38. +5 −6 akka-actor/src/main/scala/akka/actor/dungeon/Children.scala
  39. +30 −13 akka-actor/src/main/scala/akka/actor/dungeon/ChildrenContainer.scala
  40. +2 −2 akka-actor/src/main/scala/akka/actor/dungeon/FaultHandling.scala
  41. +2 −2 akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala
  42. +1 −1 akka-actor/src/main/scala/akka/dispatch/Dispatchers.scala
  43. +1 −1 akka-actor/src/main/scala/akka/dispatch/Future.scala
  44. +5 −4 akka-actor/src/main/scala/akka/event/EventBus.scala
  45. +26 −15 akka-actor/src/main/scala/akka/event/Logging.scala
  46. +36 −3 akka-actor/src/main/scala/akka/japi/JavaAPI.scala
  47. +7 −5 akka-actor/src/main/scala/akka/routing/ConsistentHash.scala
  48. +34 −16 akka-actor/src/main/scala/akka/routing/ConsistentHashingRouter.scala
  49. +73 −81 akka-actor/src/main/scala/akka/routing/Routing.scala
  50. +3 −1 akka-actor/src/main/scala/akka/routing/package.scala
  51. +22 −27 akka-actor/src/main/scala/akka/serialization/Serialization.scala
  52. +54 −0 akka-actor/src/main/scala/akka/util/Collections.scala
  53. +0 −45 akka-actor/src/main/scala/akka/util/Convert.scala
  54. +1 −1 akka-actor/src/main/scala/akka/util/Index.scala
  55. +5 −3 akka-actor/src/main/scala/akka/util/SubclassifiedIndex.scala
  56. +1 −19 akka-actor/src/main/scala/akka/util/Unsafe.java
  57. +4 −5 akka-camel/src/main/scala/akka/camel/Camel.scala
  58. +8 −3 akka-camel/src/test/scala/akka/camel/ConcurrentActivationTest.scala
  59. +1 −1 akka-cluster/src/main/scala/akka/cluster/Cluster.scala
  60. +19 −14 akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
  61. +1 −3 akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala
  62. +9 −13 akka-cluster/src/main/scala/akka/cluster/routing/ClusterRouterConfig.scala
  63. +3 −2 akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUnreachableSpec.scala
  64. +3 −2 akka-cluster/src/multi-jvm/scala/akka/cluster/ClientDowningNodeThatIsUpSpec.scala
  65. +3 −4 akka-cluster/src/multi-jvm/scala/akka/cluster/LargeClusterSpec.scala
  66. +5 −4 akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderDowningNodeThatIsUnreachableSpec.scala
  67. +2 −1 akka-cluster/src/multi-jvm/scala/akka/cluster/LeaderElectionSpec.scala
  68. +16 −19 akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala
  69. +2 −1 akka-cluster/src/multi-jvm/scala/akka/cluster/SingletonClusterSpec.scala
  70. +4 −3 akka-cluster/src/multi-jvm/scala/akka/cluster/SplitBrainSpec.scala
  71. +4 −3 akka-cluster/src/multi-jvm/scala/akka/cluster/UnreachableNodeRejoinsClusterSpec.scala
  72. +3 −3 akka-cluster/src/test/scala/akka/cluster/AccrualFailureDetectorSpec.scala
  73. +8 −8 akka-cluster/src/test/scala/akka/cluster/MetricsCollectorSpec.scala
  74. +1 −0 akka-contrib/docs/index.rst
  75. +60 −0 akka-contrib/docs/throttle.rst
  76. BIN akka-contrib/docs/throttler.png
  77. +296 −0 akka-contrib/src/main/scala/akka/contrib/throttle/TimerBasedThrottler.scala
  78. +4 −4 akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/ReliableProxySpec.scala
  79. +205 −0 akka-contrib/src/test/scala/akka/contrib/throttle/TimerBasedThrottlerSpec.scala
  80. +3 −3 akka-dataflow/src/main/scala/akka/dataflow/package.scala
  81. +1 −1 akka-docs/rst/common/duration.rst
  82. +9 −9 akka-docs/rst/dev/documentation.rst
  83. +71 −46 akka-docs/rst/dev/multi-jvm-testing.rst
  84. +2 −2 akka-docs/rst/general/actor-systems.rst
  85. +3 −3 akka-docs/rst/java/code/docs/actor/FaultHandlingTestBase.java
  86. +15 −16 akka-docs/rst/java/code/docs/actor/UntypedActorDocTestBase.java
  87. +2 −2 akka-docs/rst/java/code/docs/actor/UntypedActorSwapper.java
  88. +0 −1 akka-docs/rst/java/code/docs/event/LoggingDocTestBase.java
  89. +5 −6 akka-docs/rst/java/code/docs/jrouting/CustomRouterDocTestBase.java
  90. +16 −20 akka-docs/rst/java/untyped-actors.rst
  91. +26 −0 akka-docs/rst/project/migration-guide-2.1.x-2.2.x.rst
  92. +1 −0 akka-docs/rst/project/migration-guides.rst
  93. +31 −31 akka-docs/rst/scala/actors.rst
  94. +4 −4 akka-docs/rst/scala/code/docs/actor/ActorDocSpec.scala
  95. +6 −5 akka-docs/rst/scala/code/docs/actor/FSMDocSpec.scala
  96. +8 −5 akka-docs/rst/scala/code/docs/dataflow/DataflowDocSpec.scala
  97. +4 −3 akka-docs/rst/scala/code/docs/testkit/TestKitUsageSpec.scala
  98. +6 −6 akka-docs/rst/scala/code/docs/zeromq/ZeromqDocSpec.scala
  99. +8 −0 akka-docs/rst/scala/fsm.rst
  100. +2 −2 akka-docs/rst/scala/testing.rst
  101. +4 −1 akka-docs/rst/scala/typed-actors.rst
  102. +4 −3 akka-kernel/src/main/scala/akka/kernel/Main.scala
  103. +3 −1 akka-osgi-aries/src/main/scala/akka/osgi/aries/blueprint/BlueprintActorSystemFactory.scala
  104. +3 −3 akka-osgi-aries/src/test/scala/akka/osgi/aries/blueprint/NamespaceHandlerTest.scala
  105. +9 −4 akka-osgi/src/main/scala/akka/osgi/OsgiActorSystemFactory.scala
  106. +4 −2 akka-osgi/src/test/scala/akka/osgi/ActorSystemActivatorTest.scala
  107. +9 −14 akka-osgi/src/test/scala/akka/osgi/PojoSRTestSupport.scala
  108. +32 −0 akka-remote-tests/src/main/resources/reference.conf
  109. +1 −1 akka-remote-tests/src/main/scala/akka/remote/testconductor/Conductor.scala
  110. +19 −7 akka-remote-tests/src/main/scala/akka/remote/testconductor/Extension.scala
  111. +9 −9 akka-remote-tests/src/main/scala/akka/remote/testconductor/NetworkFailureInjector.scala
  112. +13 −13 akka-remote-tests/src/main/scala/akka/remote/testconductor/Player.scala
  113. +5 −3 akka-remote-tests/src/main/scala/akka/remote/testconductor/RemoteConnection.scala
  114. +22 −22 akka-remote-tests/src/main/scala/akka/remote/testkit/MultiNodeSpec.scala
  115. +2 −5 akka-remote-tests/src/multi-jvm/scala/akka/remote/testconductor/TestConductorSpec.scala
  116. +34 −2 akka-remote/src/main/resources/reference.conf
  117. +25 −13 akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala
  118. +4 −1 akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala
  119. +5 −4 akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala
  120. +2 −1 akka-remote/src/main/scala/akka/remote/RemoteTransport.scala
  121. +31 −22 akka-remote/src/main/scala/akka/remote/netty/Client.scala
  122. +9 −10 akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala
  123. +10 −33 akka-remote/src/main/scala/akka/remote/netty/NettySSLSupport.scala
  124. +20 −21 akka-remote/src/main/scala/akka/remote/netty/Server.scala
  125. +12 −2 akka-remote/src/main/scala/akka/remote/netty/Settings.scala
  126. +10 −12 akka-remote/src/main/scala/akka/remote/routing/RemoteRouterConfig.scala
  127. +3 −2 akka-remote/src/main/scala/akka/remote/security/provider/InternetSeedGenerator.scala
  128. +25 −0 akka-remote/src/test/scala/akka/remote/RemoteConfigSpec.scala
  129. +2 −1 ...mples/akka-sample-cluster/src/main/scala/sample/cluster/transformation/TransformationSample.scala
  130. +1 −1 ...es/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSingleMasterSpec.scala
  131. +3 −3 akka-samples/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/StatsSampleSpec.scala
  132. +3 −3 ...mples/akka-sample-cluster/src/multi-jvm/scala/sample/cluster/stats/japi/StatsSampleJapiSpec.scala
  133. +1 −1 ...ample-cluster/src/multi-jvm/scala/sample/cluster/stats/japi/StatsSampleSingleMasterJapiSpec.scala
  134. +1 −1 ...a-sample-cluster/src/multi-jvm/scala/sample/cluster/transformation/TransformationSampleSpec.scala
  135. +1 −1 ...cluster/src/multi-jvm/scala/sample/cluster/transformation/japi/TransformationSampleJapiSpec.scala
  136. +3 −3 akka-sbt-plugin/sample/project/Build.scala
  137. +1 −1 akka-sbt-plugin/sample/project/build.properties
  138. +0 −2 akka-sbt-plugin/sample/project/plugins.sbt
  139. +2 −2 akka-sbt-plugin/src/main/scala/AkkaKernelPlugin.scala
  140. +6 −6 akka-testkit/src/main/java/akka/testkit/JavaTestKit.java
  141. +1 −1 akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala
  142. +11 −10 akka-testkit/src/main/scala/akka/testkit/TestEventListener.scala
  143. +24 −24 akka-testkit/src/main/scala/akka/testkit/TestKit.scala
  144. +5 −3 akka-testkit/src/main/scala/akka/testkit/package.scala
  145. +7 −0 akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala
  146. +3 −3 akka-transactor/src/test/java/akka/transactor/UntypedCoordinatedIncrementTest.java
  147. +3 −5 akka-transactor/src/test/java/akka/transactor/UntypedTransactorTest.java
  148. +4 −3 akka-transactor/src/test/scala/akka/transactor/CoordinatedIncrementSpec.scala
  149. +8 −7 akka-transactor/src/test/scala/akka/transactor/FickleFriendsSpec.scala
  150. +3 −2 akka-transactor/src/test/scala/akka/transactor/TransactorSpec.scala
  151. +7 −6 akka-zeromq/src/main/scala/akka/zeromq/ConcurrentSocketActor.scala
  152. +17 −15 akka-zeromq/src/main/scala/akka/zeromq/SocketOption.scala
  153. +6 −3 akka-zeromq/src/main/scala/akka/zeromq/ZMQMessageDeserializer.scala
  154. +3 −1 akka-zeromq/src/main/scala/akka/zeromq/ZeroMQExtension.scala
  155. +4 −4 akka-zeromq/src/test/scala/akka/zeromq/ConcurrentSocketActorSpec.scala
  156. +4 −5 project/AkkaBuild.scala
  157. +1 −1 project/build.properties
  158. +1 −1 project/plugins.sbt
  159. +81 −4 project/scripts/release
  160. +1 −1 scripts/multi-node-log-replace.sh
@@ -1,5 +1,7 @@
package akka.japi;
+import akka.event.LoggingAdapter;
+import akka.event.NoLogging;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -46,4 +48,10 @@ public void shouldNotEnterForLoop() {
public void shouldBeSingleton() {
assertSame(Option.none(), Option.none());
}
+
+ @Test
+ public void mustBeAbleToGetNoLogging() {
+ LoggingAdapter a = NoLogging.getInstance();
+ assertNotNull(a);
+ }
}
@@ -15,7 +15,8 @@
// only to test compilability
public void testRoute() {
final ActorRef ref = system.actorOf(new Props().withRouter(new RoundRobinRouter(1)));
- final scala.Function1<scala.Tuple2<ActorRef, Object>, scala.collection.Iterable<Destination>> route = ExtractRoute.apply(ref);
+ final scala.Function1<scala.Tuple2<ActorRef, Object>,
+ scala.collection.immutable.Iterable<Destination>> route = ExtractRoute.apply(ref);
route.apply(null);
}
@@ -103,6 +103,32 @@ class ActorDSLSpec extends AkkaSpec {
i.receive() must be("hi")
}
+ "support becomeStacked" in {
+ //#becomeStacked
+ val a = actor(new Act {
+ become { // this will replace the initial (empty) behavior
+ case "info" sender ! "A"
+ case "switch"
+ becomeStacked { // this will stack upon the "A" behavior
+ case "info" sender ! "B"
+ case "switch" unbecome() // return to the "A" behavior
+ }
+ case "lobotomize" unbecome() // OH NOES: Actor.emptyBehavior
+ }
+ })
+ //#becomeStacked
+
+ implicit def sender = testActor
+ a ! "info"
+ expectMsg("A")
+ a ! "switch"
+ a ! "info"
+ expectMsg("B")
+ a ! "switch"
+ a ! "info"
+ expectMsg("A")
+ }
+
"support setup/teardown" in {
//#simple-start-stop
val a = actor(new Act {
@@ -188,7 +214,7 @@ class ActorDSLSpec extends AkkaSpec {
become {
case 1 stash()
case 2
- testActor ! 2; unstashAll(); become {
+ testActor ! 2; unstashAll(); becomeStacked {
case 1 testActor ! 1; unbecome()
}
}
@@ -4,14 +4,15 @@
package akka.actor
import language.postfixOps
+
import akka.testkit._
import org.scalatest.junit.JUnitSuite
import com.typesafe.config.ConfigFactory
import scala.concurrent.Await
import scala.concurrent.duration._
-import scala.collection.JavaConverters
-import java.util.concurrent.{ TimeUnit, RejectedExecutionException, CountDownLatch, ConcurrentLinkedQueue }
+import java.util.concurrent.{ RejectedExecutionException, ConcurrentLinkedQueue }
import akka.util.Timeout
+import akka.japi.Util.immutableSeq
import scala.concurrent.Future
import akka.pattern.ask
@@ -102,8 +103,6 @@ class ActorSystemSpec extends AkkaSpec("""akka.extensions = ["akka.actor.TestExt
}
"run termination callbacks in order" in {
- import scala.collection.JavaConverters._
-
val system2 = ActorSystem("TerminationCallbacks", AkkaSpec.testConf)
val result = new ConcurrentLinkedQueue[Int]
val count = 10
@@ -121,13 +120,11 @@ class ActorSystemSpec extends AkkaSpec("""akka.extensions = ["akka.actor.TestExt
Await.ready(latch, 5 seconds)
val expected = (for (i 1 to count) yield i).reverse
- result.asScala.toSeq must be(expected)
+ immutableSeq(result) must be(expected)
}
"awaitTermination after termination callbacks" in {
- import scala.collection.JavaConverters._
-
val system2 = ActorSystem("AwaitTermination", AkkaSpec.testConf)
@volatile
var callbackWasRun = false
@@ -14,7 +14,7 @@ import akka.dispatch.MessageDispatcher
import akka.pattern.ask
import java.net.{ Socket, InetSocketAddress, InetAddress, SocketAddress }
import scala.util.Failure
-import annotation.tailrec
+import scala.annotation.tailrec
object IOActorSpec {
@@ -55,6 +55,8 @@ object IOActorSpec {
def receive = {
+ case _: IO.Connected //don't care
+
case bytes: ByteString
val source = sender
socket write bytes
@@ -65,9 +67,9 @@ object IOActorSpec {
case IO.Closed(`socket`, cause)
state(cause)
- throw cause match {
- case IO.Error(e) e
- case _ new RuntimeException("Socket closed")
+ cause match {
+ case IO.Error(e) throw e
+ case _ throw new RuntimeException("Socket closed")
}
}
@@ -154,6 +156,8 @@ object IOActorSpec {
case IO.Read(socket, bytes)
state(socket)(IO Chunk bytes)
+ case _: IO.Connected //don't care
+
case IO.Closed(socket, cause)
state -= socket
@@ -181,6 +185,8 @@ object IOActorSpec {
readResult map (source !)
}
+ case _: IO.Connected //don't care
+
case IO.Read(`socket`, bytes)
state(IO Chunk bytes)
@@ -276,7 +282,7 @@ class IOActorSpec extends AkkaSpec with DefaultTimeout {
}
"an IO Actor" must {
- implicit val ec = system.dispatcher
+ import system.dispatcher
"run echo server" in {
filterException[java.net.ConnectException] {
val addressPromise = Promise[SocketAddress]()
@@ -43,9 +43,10 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
val childName = "akka%3A%2F%2FClusterSystem%40127.0.0.1%3A2552"
val a = system.actorOf(Props(new Actor {
val child = context.actorOf(Props.empty, name = childName)
- assert(childName == child.path.name)
def receive = {
- case "lookup" sender ! context.actorFor(childName)
+ case "lookup"
+ if (childName == child.path.name) sender ! context.actorFor(childName)
+ else sender ! s"$childName is not ${child.path.name}!"
}
}))
a.tell("lookup", testActor)
@@ -6,24 +6,22 @@ package akka.actor
import org.scalatest.WordSpec
import org.scalatest.matchers.MustMatchers
import java.net.URLEncoder
+import scala.collection.immutable
class RelativeActorPathSpec extends WordSpec with MustMatchers {
- def elements(path: String): Seq[String] = path match {
- case RelativeActorPath(elem) elem.toSeq
- case _ Nil
- }
+ def elements(path: String): immutable.Seq[String] = RelativeActorPath.unapply(path).getOrElse(Nil)
"RelativeActorPath" must {
"match single name" in {
- elements("foo") must be(Seq("foo"))
+ elements("foo") must be(List("foo"))
}
"match path separated names" in {
- elements("foo/bar/baz") must be(Seq("foo", "bar", "baz"))
+ elements("foo/bar/baz") must be(List("foo", "bar", "baz"))
}
"match url encoded name" in {
val name = URLEncoder.encode("akka://ClusterSystem@127.0.0.1:2552", "UTF-8")
- elements(name) must be(Seq(name))
+ elements(name) must be(List(name))
}
}
}
@@ -194,7 +194,7 @@ object SupervisorHierarchySpec {
case x (x, x)
}
override val supervisorStrategy = OneForOneStrategy()(unwrap andThen {
- case _: Failure if pongsToGo > 0
+ case (_: Failure, _) if pongsToGo > 0
log :+= Event("pongOfDeath resuming " + sender, identityHashCode(this))
Resume
case (f: Failure, orig)
@@ -391,10 +391,10 @@ object SupervisorHierarchySpec {
// don’t escalate from this one!
override val supervisorStrategy = OneForOneStrategy() {
- case f: Failure f.directive
- case OriginalRestartException(f: Failure) f.directive
- case ActorInitializationException(f: Failure) f.directive
- case _ Stop
+ case f: Failure f.directive
+ case OriginalRestartException(f: Failure) f.directive
+ case ActorInitializationException(_, _, f: Failure) f.directive
+ case _ Stop
}
var children = Vector.empty[ActorRef]
@@ -5,18 +5,19 @@ package akka.actor
import language.postfixOps
import org.scalatest.{ BeforeAndAfterAll, BeforeAndAfterEach }
-import akka.util.Timeout
+import scala.annotation.tailrec
+import scala.collection.immutable
import scala.concurrent.{ Await, Future, Promise }
import scala.concurrent.duration._
-import java.util.concurrent.atomic.AtomicReference
-import annotation.tailrec
import akka.testkit.{ EventFilter, filterEvents, AkkaSpec }
+import akka.util.Timeout
import akka.japi.{ Option JOption }
import akka.testkit.DefaultTimeout
-import akka.dispatch.{ Dispatchers }
+import akka.dispatch.Dispatchers
import akka.pattern.ask
import akka.serialization.JavaSerializer
import akka.actor.TypedActor._
+import java.util.concurrent.atomic.AtomicReference
import java.lang.IllegalStateException
import java.util.concurrent.{ TimeoutException, TimeUnit, CountDownLatch }
@@ -35,9 +36,9 @@ object TypedActorSpec {
}
"""
- class CyclicIterator[T](val items: Seq[T]) extends Iterator[T] {
+ class CyclicIterator[T](val items: immutable.Seq[T]) extends Iterator[T] {
- private[this] val current: AtomicReference[Seq[T]] = new AtomicReference(items)
+ private[this] val current = new AtomicReference(items)
def hasNext = items != Nil
@@ -45,6 +45,9 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin
getInt("akka.actor.deployment.default.virtual-nodes-factor") must be(10)
settings.DefaultVirtualNodesFactor must be(10)
+
+ getMilliseconds("akka.actor.unstarted-push-timeout") must be(10.seconds.toMillis)
+ settings.UnstartedPushTimeout.duration must be(10.seconds)
}
{
@@ -6,10 +6,9 @@ import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import com.typesafe.config.Config
-import akka.actor.{ Props, InternalActorRef, ActorSystem, Actor }
+import akka.actor.{ Props, ActorSystem, Actor }
import akka.pattern.ask
import akka.testkit.{ DefaultTimeout, AkkaSpec }
-import scala.concurrent.Await
import scala.concurrent.duration._
object PriorityDispatcherSpec {
@@ -50,24 +49,23 @@ class PriorityDispatcherSpec extends AkkaSpec(PriorityDispatcherSpec.config) wit
}
def testOrdering(dispatcherKey: String) {
+ val msgs = (1 to 100) toList
val actor = system.actorOf(Props(new Actor {
- var acc: List[Int] = Nil
- def receive = {
- case i: Int acc = i :: acc
- case 'Result sender ! acc
- }
- }).withDispatcher(dispatcherKey)).asInstanceOf[InternalActorRef]
+ val acc = scala.collection.mutable.ListBuffer[Int]()
- actor.suspend //Make sure the actor isn't treating any messages, let it buffer the incoming messages
+ scala.util.Random.shuffle(msgs) foreach { m self ! m }
- val msgs = (1 to 100).toList
- for (m msgs) actor ! m
+ self.tell('Result, testActor)
- actor.resume(causedByFailure = null) //Signal the actor to start treating it's message backlog
+ def receive = {
+ case i: Int acc += i
+ case 'Result sender ! acc.toList
+ }
+ }).withDispatcher(dispatcherKey))
- Await.result(actor.?('Result).mapTo[List[Int]], timeout.duration) must be === msgs.reverse
+ expectMsgType[List[_]] must be === msgs
}
}
Oops, something went wrong.

0 comments on commit 0f0c5cb

Please sign in to comment.