-
Notifications
You must be signed in to change notification settings - Fork 28.6k
SPARK-3470 [CORE] [STREAMING] Add Closeable / close() to Java context objects #2346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
QA tests have started for PR 2346 at commit
|
The relevant PR: #991 |
QA tests have finished for PR 2346 at commit
|
since spark targets java 7 & 8, why not just use the correct AutoCloseable? |
It doesn't target Java 7: https://github.com/apache/spark/blob/master/pom.xml#L113 |
you're right. i hope it becomes java 7+ and we can move to AutoCloseable |
|
would like a unit test, but lgtm |
Yup, LGTM |
@@ -40,7 +41,9 @@ import org.apache.spark.rdd.{EmptyRDD, HadoopRDD, NewHadoopRDD, RDD} | |||
* A Java-friendly version of [[org.apache.spark.SparkContext]] that returns | |||
* [[org.apache.spark.api.java.JavaRDD]]s and works with Java collections instead of Scala ones. | |||
*/ | |||
class JavaSparkContext(val sc: SparkContext) extends JavaSparkContextVarargsWorkaround { | |||
class JavaSparkContext(val sc: SparkContext) | |||
extends JavaSparkContextVarargsWorkaround with Closeable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note two space indent here, but don't worry i will fix it.
@srowen any reason you did not add this to the Scala SparkContext? |
@rxin (Yeah wasn't sure how to handle the continuation indent, feel free to change it.) I didn't add it to |
... that expose a stop() lifecycle method. This doesn't add
AutoCloseable
, which is Java 7+ only. But it should be possible to use try-with-resources on aCloseable
in Java 7, as long as theclose()
does not throw a checked exception, and these don't. Q.E.D.