Minor updates after further feedback. See #1529
This commit is contained in:
parent
dac0beb01b
commit
1a8e755738
2 changed files with 12 additions and 14 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue