You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/01/13 05:04:38 UTC

[2/8] git commit: Added waitForStop and stop to JavaStreamingContext.

Added waitForStop and stop to JavaStreamingContext.


Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/4d9b0ab4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/4d9b0ab4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/4d9b0ab4

Branch: refs/heads/master
Commit: 4d9b0ab420df383869fa586b229ac00f234b8749
Parents: f5108ff
Author: Tathagata Das <ta...@gmail.com>
Authored: Sat Jan 11 23:35:51 2014 -0800
Committer: Tathagata Das <ta...@gmail.com>
Committed: Sat Jan 11 23:35:51 2014 -0800

----------------------------------------------------------------------
 .../spark/streaming/StreamingContext.scala      |  5 +++--
 .../api/java/JavaStreamingContext.scala         | 21 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/4d9b0ab4/streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala
----------------------------------------------------------------------
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala b/streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala
index b20dbdd8..7b2a7d5 100644
--- a/streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala
+++ b/streaming/src/main/scala/org/apache/spark/streaming/StreamingContext.scala
@@ -432,7 +432,7 @@ class StreamingContext private[streaming] (
 
   /**
    * Wait for the execution to stop. Any exceptions that occurs during the execution
-   * will be thrown here.
+   * will be thrown in this thread.
    */
   def waitForStop() {
     waiter.waitForStopOrError()
@@ -440,7 +440,7 @@ class StreamingContext private[streaming] (
 
   /**
    * Wait for the execution to stop. Any exceptions that occurs during the execution
-   * will be thrown here.
+   * will be thrown in this thread.
    * @param timeout time to wait
    */
   def waitForStop(timeout: Long) {
@@ -449,6 +449,7 @@ class StreamingContext private[streaming] (
 
   /**
    * Stop the execution of the streams.
+   * @param stopSparkContext Stop the associated SparkContext or not
    */
   def stop(stopSparkContext: Boolean = true) = synchronized {
     scheduler.stop()

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/4d9b0ab4/streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaStreamingContext.scala
----------------------------------------------------------------------
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaStreamingContext.scala b/streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaStreamingContext.scala
index 523173d..ea7f7da 100644
--- a/streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaStreamingContext.scala
+++ b/streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaStreamingContext.scala
@@ -483,9 +483,28 @@ class JavaStreamingContext(val ssc: StreamingContext) {
   def start() = ssc.start()
 
   /**
-   * Stop the execution of the streams.
+   * Wait for the execution to stop. Any exceptions that occurs during the execution
+   * will be thrown in this thread.
+   */
+  def waitForStop() = ssc.waitForStop()
+
+  /**
+   * Wait for the execution to stop. Any exceptions that occurs during the execution
+   * will be thrown in this thread.
+   * @param timeout time to wait
+   */
+  def waitForStop(timeout: Long) = ssc.waitForStop(timeout)
+
+  /**
+   * Stop the execution of the streams. Will stop the associated JavaSparkContext as well.
    */
   def stop() = ssc.stop()
+
+  /**
+   * Stop the execution of the streams.
+   * @param stopSparkContext Stop the associated SparkContext or not
+   */
+  def stop(stopSparkContext: Boolean) = ssc.stop(stopSparkContext)
 }
 
 /**