Skip to content
Snippets Groups Projects
Commit 01bd136b authored by Matei Zaharia's avatar Matei Zaharia
Browse files

Use public method sparkContext instead of protected sc in streaming examples

parent 848321f9
No related branches found
No related tags found
No related merge requests found
...@@ -30,10 +30,10 @@ object QueueStream { ...@@ -30,10 +30,10 @@ object QueueStream {
// Create and push some RDDs into // Create and push some RDDs into
for (i <- 1 to 30) { for (i <- 1 to 30) {
rddQueue += ssc.sc.makeRDD(1 to 1000, 10) rddQueue += sc.sparkContext.makeRDD(1 to 1000, 10)
Thread.sleep(1000) Thread.sleep(1000)
} }
ssc.stop() ssc.stop()
System.exit(0) System.exit(0)
} }
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ object RawNetworkGrep { ...@@ -34,7 +34,7 @@ object RawNetworkGrep {
val ssc = new StreamingContext(master, "RawNetworkGrep", Milliseconds(batchMillis)) val ssc = new StreamingContext(master, "RawNetworkGrep", Milliseconds(batchMillis))
// Warm up the JVMs on master and slave for JIT compilation to kick in // Warm up the JVMs on master and slave for JIT compilation to kick in
RawTextHelper.warmUp(ssc.sc) RawTextHelper.warmUp(sc.sparkContext)
val rawStreams = (1 to numStreams).map(_ => val rawStreams = (1 to numStreams).map(_ =>
ssc.rawSocketStream[String](host, port, StorageLevel.MEMORY_ONLY_SER_2)).toArray ssc.rawSocketStream[String](host, port, StorageLevel.MEMORY_ONLY_SER_2)).toArray
......
...@@ -60,7 +60,7 @@ object PageViewStream { ...@@ -60,7 +60,7 @@ object PageViewStream {
.map("Unique active users: " + _) .map("Unique active users: " + _)
// An external dataset we want to join to this stream // An external dataset we want to join to this stream
val userList = ssc.sc.parallelize( val userList = ssc.sparkContext.parallelize(
Map(1 -> "Patrick Wendell", 2->"Reynold Xin", 3->"Matei Zaharia").toSeq) Map(1 -> "Patrick Wendell", 2->"Reynold Xin", 3->"Matei Zaharia").toSeq)
metric match { metric match {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment