|
Akka/Scala example source code file (StatsWorker.scala)
The StatsWorker.scala Akka example source codepackage sample.cluster.stats import akka.actor.Actor //#worker class StatsWorker extends Actor { var cache = Map.empty[String, Int] def receive = { case word: String => val length = cache.get(word) match { case Some(x) => x case None => val x = word.length cache += (word -> x) x } sender() ! length } } //#worker Other Akka source code examplesHere is a short list of links related to this Akka StatsWorker.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.