Skip to content

Instantly share code, notes, and snippets.

@derekjw
Created September 17, 2012 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derekjw/3738032 to your computer and use it in GitHub Desktop.
Save derekjw/3738032 to your computer and use it in GitHub Desktop.
Akka Eventstream fix
--- /home/derek/Development/Projects/akka/akka-actor/src/main/scala/akka/util/SubclassifiedIndex.scala 2012-09-17 09:25:41.807104726 -0600
+++ SubclassifiedIndex.scala 2012-09-01 11:43:45.906813283 -0600
@@ -79,14 +78,16 @@
* Add key to this index which inherits its value set from the most specific
* super-class which is known.
*/
- def addKey(key: K): Changes =
- subkeys collectFirst {
+ def addKey(key: K): Changes = {
+ val ch = subkeys collect {
case n if sc.isEqual(n.key, key) ⇒ Nil
case n if sc.isSubclass(key, n.key) ⇒ n.addKey(key)
- } getOrElse {
+ }
+ if (ch.isEmpty) {
integrate(new Nonroot(key, values))
List((key, values))
- }
+ } else ch.flatten
+ }
/**
* Add value to all keys which are subclasses of the given key. If the key
private def updateCache(diff: Seq[(Classifier, Set[Subscriber])]): Boolean =
if (diff.isEmpty) false
else {
subscriptions.synchronized {
_cache ++= (diff groupBy (_._1) mapValues (kvs => (kvs.head._2 /: kvs.tail)(_ ++ _._2)))
}
true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment