aboutsummaryrefslogtreecommitdiff
path: root/streaming
diff options
context:
space:
mode:
authorPatrick Wendell <pwendell@gmail.com>2013-02-05 11:41:31 -0800
committerPatrick Wendell <pwendell@gmail.com>2013-02-05 11:43:16 -0800
commit7eea64aa4c0d6a51406e0d1b039906ee9559cd58 (patch)
tree58af0720b7b6616c050a7d52de6525a64d777b1a /streaming
parentf6ec547ea7b56ee607a4c2a69206f8952318eaf1 (diff)
downloadspark-7eea64aa4c0d6a51406e0d1b039906ee9559cd58.tar.gz
spark-7eea64aa4c0d6a51406e0d1b039906ee9559cd58.tar.bz2
spark-7eea64aa4c0d6a51406e0d1b039906ee9559cd58.zip
Streaming constructor which takes JavaSparkContext
It's sometimes helpful to directly pass a JavaSparkContext, and take advantage of the various constructors available for that.
Diffstat (limited to 'streaming')
-rw-r--r--streaming/src/main/scala/spark/streaming/api/java/JavaStreamingContext.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/streaming/src/main/scala/spark/streaming/api/java/JavaStreamingContext.scala b/streaming/src/main/scala/spark/streaming/api/java/JavaStreamingContext.scala
index f82e6a37cc..e7f446a49b 100644
--- a/streaming/src/main/scala/spark/streaming/api/java/JavaStreamingContext.scala
+++ b/streaming/src/main/scala/spark/streaming/api/java/JavaStreamingContext.scala
@@ -34,6 +34,14 @@ class JavaStreamingContext(val ssc: StreamingContext) {
this(new StreamingContext(master, frameworkName, batchDuration))
/**
+ * Creates a StreamingContext.
+ * @param sparkContext The underlying JavaSparkContext to use
+ * @param batchDuration The time interval at which streaming data will be divided into batches
+ */
+ def this(sparkContext: JavaSparkContext, batchDuration: Duration) =
+ this(new StreamingContext(sparkContext.sc, batchDuration))
+
+ /**
* Re-creates a StreamingContext from a checkpoint file.
* @param path Path either to the directory that was specified as the checkpoint directory, or
* to the checkpoint file 'graph' or 'graph.bk'.