diff options
author | sachin aggarwal <different.sachin@gmail.com> | 2016-02-09 08:52:58 +0000 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-02-09 08:52:58 +0000 |
commit | d9ba4d27f4d324a7055b9b914c75d176f3e2f71d (patch) | |
tree | ae934ac041c1949a570f48a93aebb71382bddc96 /examples/src | |
parent | c882ec57de509895706dcafea8234238e4277a2d (diff) | |
download | spark-d9ba4d27f4d324a7055b9b914c75d176f3e2f71d.tar.gz spark-d9ba4d27f4d324a7055b9b914c75d176f3e2f71d.tar.bz2 spark-d9ba4d27f4d324a7055b9b914c75d176f3e2f71d.zip |
[SPARK-13177][EXAMPLES] Update ActorWordCount example to not directly use low level linked list as it is deprecated.
Author: sachin aggarwal <different.sachin@gmail.com>
Closes #11113 from agsachin/master.
Diffstat (limited to 'examples/src')
-rw-r--r-- | examples/src/main/scala/org/apache/spark/examples/streaming/ActorWordCount.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/src/main/scala/org/apache/spark/examples/streaming/ActorWordCount.scala b/examples/src/main/scala/org/apache/spark/examples/streaming/ActorWordCount.scala index 8e88987439..9f7c7d50e5 100644 --- a/examples/src/main/scala/org/apache/spark/examples/streaming/ActorWordCount.scala +++ b/examples/src/main/scala/org/apache/spark/examples/streaming/ActorWordCount.scala @@ -18,7 +18,7 @@ // scalastyle:off println package org.apache.spark.examples.streaming -import scala.collection.mutable.LinkedList +import scala.collection.mutable.LinkedHashSet import scala.reflect.ClassTag import scala.util.Random @@ -39,7 +39,7 @@ case class UnsubscribeReceiver(receiverActor: ActorRef) class FeederActor extends Actor { val rand = new Random() - var receivers: LinkedList[ActorRef] = new LinkedList[ActorRef]() + val receivers = new LinkedHashSet[ActorRef]() val strings: Array[String] = Array("words ", "may ", "count ") @@ -63,11 +63,11 @@ class FeederActor extends Actor { def receive: Receive = { case SubscribeReceiver(receiverActor: ActorRef) => println("received subscribe from %s".format(receiverActor.toString)) - receivers = LinkedList(receiverActor) ++ receivers + receivers += receiverActor case UnsubscribeReceiver(receiverActor: ActorRef) => println("received unsubscribe from %s".format(receiverActor.toString)) - receivers = receivers.dropWhile(x => x eq receiverActor) + receivers -= receiverActor } } |