format source with scalafmt

This commit is contained in:
Auto Format 2019-03-11 10:38:24 +01:00 committed by Patrik Nordwall
parent 0f40491d42
commit ce404e4f53
1669 changed files with 43208 additions and 35404 deletions

View file

@ -15,20 +15,16 @@ class StatsService extends Actor {
// This router is used both with lookup and deploy of routees. If you
// have a router with only lookup of routees you can use Props.empty
// instead of Props[StatsWorker.class].
val workerRouter = context.actorOf(
FromConfig.props(Props[StatsWorker]),
name = "workerRouter")
val workerRouter = context.actorOf(FromConfig.props(Props[StatsWorker]), name = "workerRouter")
def receive = {
case StatsJob(text) if text != "" =>
val words = text.split(" ")
val replyTo = sender() // important to not close over sender()
// create actor that collects replies from workers
val aggregator = context.actorOf(Props(
classOf[StatsAggregator], words.size, replyTo))
words foreach { word =>
workerRouter.tell(
ConsistentHashableEnvelope(word, word), aggregator)
val aggregator = context.actorOf(Props(classOf[StatsAggregator], words.size, replyTo))
words.foreach { word =>
workerRouter.tell(ConsistentHashableEnvelope(word, word), aggregator)
}
}
}
@ -59,9 +55,11 @@ abstract class StatsService2 extends Actor {
import akka.routing.ConsistentHashingGroup
val workerRouter = context.actorOf(
ClusterRouterGroup(ConsistentHashingGroup(Nil), ClusterRouterGroupSettings(
totalInstances = 100, routeesPaths = List("/user/statsWorker"),
allowLocalRoutees = true, useRoles = Set("compute"))).props(),
ClusterRouterGroup(ConsistentHashingGroup(Nil),
ClusterRouterGroupSettings(totalInstances = 100,
routeesPaths = List("/user/statsWorker"),
allowLocalRoutees = true,
useRoles = Set("compute"))).props(),
name = "workerRouter2")
//#router-lookup-in-code
}
@ -73,9 +71,10 @@ abstract class StatsService3 extends Actor {
import akka.routing.ConsistentHashingPool
val workerRouter = context.actorOf(
ClusterRouterPool(ConsistentHashingPool(0), ClusterRouterPoolSettings(
totalInstances = 100, maxInstancesPerNode = 3,
allowLocalRoutees = false)).props(Props[StatsWorker]),
ClusterRouterPool(ConsistentHashingPool(0),
ClusterRouterPoolSettings(totalInstances = 100,
maxInstancesPerNode = 3,
allowLocalRoutees = false)).props(Props[StatsWorker]),
name = "workerRouter3")
//#router-deploy-in-code
}