diff --git a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala index 0ffdbe7c71..5fe7ea893b 100644 --- a/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala +++ b/akka-contrib/src/multi-jvm/scala/akka/contrib/pattern/DistributedPubSubMediatorSpec.scala @@ -348,13 +348,13 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia "transfer delta correctly" in { val firstAddress = node(first).address - val secondAddress = node(second).address - val thirdAddress = node(third).address + val secondAddress = node(second).address + val thirdAddress = node(third).address runOn(first) { mediator ! Status(versions = Map.empty) val deltaBuckets = expectMsgType[Delta].buckets - deltaBuckets.size must be (3) + deltaBuckets.size must be(3) deltaBuckets.find(_.owner == firstAddress).get.content.size must be(7) deltaBuckets.find(_.owner == secondAddress).get.content.size must be(6) deltaBuckets.find(_.owner == thirdAddress).get.content.size must be(2) @@ -364,26 +364,25 @@ class DistributedPubSubMediatorSpec extends MultiNodeSpec(DistributedPubSubMedia // this test is configured with max-delta-elements = 500 val many = 1010 runOn(first) { - for (i <- 0 until many) + for (i ← 0 until many) mediator ! Put(createChatUser("u" + (1000 + i))) mediator ! Status(versions = Map.empty) val deltaBuckets1 = expectMsgType[Delta].buckets - deltaBuckets1.map(_.content.size).sum must be (500) + deltaBuckets1.map(_.content.size).sum must be(500) - mediator ! Status(versions = deltaBuckets1.map(b => b.owner -> b.version).toMap) + mediator ! Status(versions = deltaBuckets1.map(b ⇒ b.owner -> b.version).toMap) val deltaBuckets2 = expectMsgType[Delta].buckets - deltaBuckets1.map(_.content.size).sum must be (500) + deltaBuckets1.map(_.content.size).sum must be(500) - mediator ! Status(versions = deltaBuckets2.map(b => b.owner -> b.version).toMap) + mediator ! Status(versions = deltaBuckets2.map(b ⇒ b.owner -> b.version).toMap) val deltaBuckets3 = expectMsgType[Delta].buckets - deltaBuckets3.map(_.content.size).sum must be (7 + 6 + 2 + many - 500 - 500) + deltaBuckets3.map(_.content.size).sum must be(7 + 6 + 2 + many - 500 - 500) } - enterBarrier("verified-delta-with-many") - within (10.seconds) { + within(10.seconds) { awaitCount(13 + many) } diff --git a/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala b/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala index 8b602d8c93..a483f04d95 100644 --- a/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala @@ -10,7 +10,7 @@ import akka.actor.{ ActorContext, TypedActor, TypedProps } import org.scalatest.{ BeforeAndAfterAll, WordSpec } import org.scalatest.matchers.MustMatchers import akka.testkit._ -//#typed-actor-impl + //Mr funny man avoids printing to stdout AND keeping docs alright import java.lang.String.{ valueOf ⇒ println } import akka.actor.ActorRef @@ -34,26 +34,24 @@ class SquarerImpl(val name: String) extends Squarer { def this() = this("default") //#typed-actor-impl-methods - import TypedActor.dispatcher //So we can create Promises - def squareDontCare(i: Int): Unit = i * i //Nobody cares :( - def square(i: Int): Future[Int] = Promise.successful(i * i).future + def square(i: Int): Future[Int] = Future.successful(i * i) def squareNowPlease(i: Int): Option[Int] = Some(i * i) def squareNow(i: Int): Int = i * i //#typed-actor-impl-methods } +//#typed-actor-impl //#typed-actor-supercharge trait Foo { def doFoo(times: Int): Unit = println("doFoo(" + times + ")") } trait Bar { - import TypedActor.dispatcher //So we have an implicit dispatcher for our Promise def doBar(str: String): Future[String] = - Promise.successful(str.toUpperCase).future + Future.successful(str.toUpperCase) } class FooBar extends Foo with Bar diff --git a/akka-docs/rst/scala/typed-actors.rst b/akka-docs/rst/scala/typed-actors.rst index f930e153be..0bdf0f7e39 100644 --- a/akka-docs/rst/scala/typed-actors.rst +++ b/akka-docs/rst/scala/typed-actors.rst @@ -60,13 +60,14 @@ Our example interface: .. includecode:: code/docs/actor/TypedActorDocSpec.scala :include: imports,typed-actor-iface - :exclude: typed-actor-iface-methods -Our example implementation of that interface: +Alright, now we've got some methods we can call, but we need to implement those in SquarerImpl. .. includecode:: code/docs/actor/TypedActorDocSpec.scala :include: imports,typed-actor-impl - :exclude: typed-actor-impl-methods + +Excellent, now we have an interface and an implementation of that interface, +and we know how to create a Typed Actor from that, so let's look at calling these methods. The most trivial way of creating a Typed Actor instance of our Squarer: @@ -81,18 +82,6 @@ If you need to call a specific constructor you do it like this: :include: typed-actor-create2 Since you supply a Props, you can specify which dispatcher to use, what the default timeout should be used and more. -Now, our Squarer doesn't have any methods, so we'd better add those. - -.. includecode:: code/docs/actor/TypedActorDocSpec.scala - :include: imports,typed-actor-iface - -Alright, now we've got some methods we can call, but we need to implement those in SquarerImpl. - -.. includecode:: code/docs/actor/TypedActorDocSpec.scala - :include: imports,typed-actor-impl - -Excellent, now we have an interface and an implementation of that interface, -and we know how to create a Typed Actor from that, so let's look at calling these methods. Method dispatch semantics -------------------------