diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala index cffd7776c4..711e7cc3a3 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala @@ -373,12 +373,12 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { "custom router" must { "be started when constructed" in { - val routedActor = system.actorOf(Props[TestActor].withRouter(new VoteCountRouter)) + val routedActor = system.actorOf(Props[TestActor].withRouter(VoteCountRouter)) routedActor.isTerminated must be(false) } "count votes as intended - not as in Florida" in { - val routedActor = system.actorOf(Props[TestActor].withRouter(new VoteCountRouter)) + val routedActor = system.actorOf(Props[TestActor].withRouter(VoteCountRouter)) routedActor ! DemocratVote routedActor ! DemocratVote routedActor ! RepublicanVote @@ -422,7 +422,7 @@ class RoutingSpec extends AkkaSpec with DefaultTimeout with ImplicitSender { //#crActors //#crRouter - class VoteCountRouter extends RouterConfig { + object VoteCountRouter extends RouterConfig { //#crRoute def createRoute(props: Props, diff --git a/akka-actor/src/main/scala/akka/routing/Routing.scala b/akka-actor/src/main/scala/akka/routing/Routing.scala index 1d0de394cf..86dc9d80d4 100644 --- a/akka-actor/src/main/scala/akka/routing/Routing.scala +++ b/akka-actor/src/main/scala/akka/routing/Routing.scala @@ -167,8 +167,6 @@ case class Destination(sender: ActorRef, recipient: ActorRef) * Oxymoron style. */ case object NoRouter extends RouterConfig { - def nrOfInstances: Int = 0 - def routees: Iterable[String] = Nil def createRoute(props: Props, actorContext: ActorContext, ref: RoutedActorRef): Route = null } @@ -207,9 +205,9 @@ case class RoundRobinRouter(nrOfInstances: Int = 0, routees: Iterable[String] = trait RoundRobinLike { this: RouterConfig ⇒ - val nrOfInstances: Int + def nrOfInstances: Int - val routees: Iterable[String] + def routees: Iterable[String] def createRoute(props: Props, context: ActorContext, ref: RoutedActorRef): Route = { createAndRegisterRoutees(props, context, nrOfInstances, routees) @@ -267,9 +265,9 @@ trait RandomLike { this: RouterConfig ⇒ import java.security.SecureRandom - val nrOfInstances: Int + def nrOfInstances: Int - val routees: Iterable[String] + def routees: Iterable[String] private val random = new ThreadLocal[SecureRandom] { override def initialValue = SecureRandom.getInstance("SHA1PRNG") @@ -327,9 +325,9 @@ case class BroadcastRouter(nrOfInstances: Int = 0, routees: Iterable[String] = N trait BroadcastLike { this: RouterConfig ⇒ - val nrOfInstances: Int + def nrOfInstances: Int - val routees: Iterable[String] + def routees: Iterable[String] def createRoute(props: Props, context: ActorContext, ref: RoutedActorRef): Route = { createAndRegisterRoutees(props, context, nrOfInstances, routees) @@ -379,11 +377,11 @@ case class ScatterGatherFirstCompletedRouter(nrOfInstances: Int = 0, routees: It trait ScatterGatherFirstCompletedLike { this: RouterConfig ⇒ - val nrOfInstances: Int + def nrOfInstances: Int - val routees: Iterable[String] + def routees: Iterable[String] - val within: Duration + def within: Duration def createRoute(props: Props, context: ActorContext, ref: RoutedActorRef): Route = { createAndRegisterRoutees(props, context, nrOfInstances, routees)