Skip to content
Snippets Groups Projects
Commit 7eea64aa authored by Patrick Wendell's avatar Patrick Wendell
Browse files

Streaming constructor which takes JavaSparkContext

It's sometimes helpful to directly pass a JavaSparkContext,
and take advantage of the various constructors available for that.
parent f6ec547e
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,14 @@ class JavaStreamingContext(val ssc: StreamingContext) { ...@@ -33,6 +33,14 @@ class JavaStreamingContext(val ssc: StreamingContext) {
def this(master: String, frameworkName: String, batchDuration: Duration) = def this(master: String, frameworkName: String, batchDuration: Duration) =
this(new StreamingContext(master, frameworkName, batchDuration)) 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. * Re-creates a StreamingContext from a checkpoint file.
* @param path Path either to the directory that was specified as the checkpoint directory, or * @param path Path either to the directory that was specified as the checkpoint directory, or
......
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