From 8bd05c9db2e9c1c77fd06d490e5d4136acd6821c Mon Sep 17 00:00:00 2001 From: Sean Owen Date: Thu, 21 Apr 2016 11:03:16 +0100 Subject: [SPARK-8393][STREAMING] JavaStreamingContext#awaitTermination() throws non-declared InterruptedException ## What changes were proposed in this pull request? `JavaStreamingContext.awaitTermination` methods should be declared as `throws[InterruptedException]` so that this exception can be handled in Java code. Note this is not just a doc change, but an API change, since now (in Java) the method has a checked exception to handle. All await-like methods in Java APIs behave this way, so seems worthwhile for 2.0. ## How was this patch tested? Jenkins tests Author: Sean Owen Closes #12418 from srowen/SPARK-8393. --- .../org/apache/spark/streaming/api/java/JavaStreamingContext.scala | 2 ++ 1 file changed, 2 insertions(+) (limited to 'streaming/src') 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 922e4a5e4d..7e78fa1d7e 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 @@ -558,6 +558,7 @@ class JavaStreamingContext(val ssc: StreamingContext) extends Closeable { * Wait for the execution to stop. Any exceptions that occurs during the execution * will be thrown in this thread. */ + @throws[InterruptedException] def awaitTermination(): Unit = { ssc.awaitTermination() } @@ -570,6 +571,7 @@ class JavaStreamingContext(val ssc: StreamingContext) extends Closeable { * @return `true` if it's stopped; or throw the reported error during the execution; or `false` * if the waiting time elapsed before returning from the method. */ + @throws[InterruptedException] def awaitTerminationOrTimeout(timeout: Long): Boolean = { ssc.awaitTerminationOrTimeout(timeout) } -- cgit v1.2.3