[jira] [Commented] (SPARK-3470) Have JavaSparkContext implement Closeable/AutoCloseable
[ https://issues.apache.org/jira/browse/SPARK-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14128232#comment-14128232 ] Sean Owen commented on SPARK-3470: -- If you implement {{AutoCloseable}}, then Spark will not work on Java 6, since this class does not exist before Java 7. Implementing {{Closeable}} is fine of course. I assume it would just call {{stop()}} Have JavaSparkContext implement Closeable/AutoCloseable --- Key: SPARK-3470 URL: https://issues.apache.org/jira/browse/SPARK-3470 Project: Spark Issue Type: New Feature Components: Spark Core Affects Versions: 1.0.2 Reporter: Shay Rojansky Priority: Minor After discussion in SPARK-2972, it seems like a good idea to allow Java developers to use Java 7 automatic resource management with JavaSparkContext, like so: {code:java} try (JavaSparkContext ctx = new JavaSparkContext(...)) { return br.readLine(); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-3470) Have JavaSparkContext implement Closeable/AutoCloseable
[ https://issues.apache.org/jira/browse/SPARK-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14128285#comment-14128285 ] Shay Rojansky commented on SPARK-3470: -- Good point about AutoCloseable. Yes, the idea is for Closeable to call stop(). I'd submit a PR myself but I don't know any Scala whatsoever... Have JavaSparkContext implement Closeable/AutoCloseable --- Key: SPARK-3470 URL: https://issues.apache.org/jira/browse/SPARK-3470 Project: Spark Issue Type: New Feature Components: Spark Core Affects Versions: 1.0.2 Reporter: Shay Rojansky Priority: Minor After discussion in SPARK-2972, it seems like a good idea to allow Java developers to use Java 7 automatic resource management with JavaSparkContext, like so: {code:java} try (JavaSparkContext ctx = new JavaSparkContext(...)) { return br.readLine(); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-3470) Have JavaSparkContext implement Closeable/AutoCloseable
[ https://issues.apache.org/jira/browse/SPARK-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14128552#comment-14128552 ] Apache Spark commented on SPARK-3470: - User 'srowen' has created a pull request for this issue: https://github.com/apache/spark/pull/2346 Have JavaSparkContext implement Closeable/AutoCloseable --- Key: SPARK-3470 URL: https://issues.apache.org/jira/browse/SPARK-3470 Project: Spark Issue Type: New Feature Components: Spark Core Affects Versions: 1.0.2 Reporter: Shay Rojansky Priority: Minor After discussion in SPARK-2972, it seems like a good idea to allow Java developers to use Java 7 automatic resource management with JavaSparkContext, like so: {code:java} try (JavaSparkContext ctx = new JavaSparkContext(...)) { return br.readLine(); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-3470) Have JavaSparkContext implement Closeable/AutoCloseable
[ https://issues.apache.org/jira/browse/SPARK-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14128751#comment-14128751 ] Matthew Farrellee commented on SPARK-3470: -- while you can implement Closeable in java 7+ and use try (Closeable c = new ...) { ... } (at least w/ openjdk 1.8), since spark targets java 7+, why not just use AutoCloseable? Have JavaSparkContext implement Closeable/AutoCloseable --- Key: SPARK-3470 URL: https://issues.apache.org/jira/browse/SPARK-3470 Project: Spark Issue Type: New Feature Components: Spark Core Affects Versions: 1.0.2 Reporter: Shay Rojansky Priority: Minor After discussion in SPARK-2972, it seems like a good idea to allow Java developers to use Java 7 automatic resource management with JavaSparkContext, like so: {code:java} try (JavaSparkContext ctx = new JavaSparkContext(...)) { return br.readLine(); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-3470) Have JavaSparkContext implement Closeable/AutoCloseable
[ https://issues.apache.org/jira/browse/SPARK-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14128764#comment-14128764 ] Sean Owen commented on SPARK-3470: -- Spark retains compatibility with Java 6 on purpose AFAIK. But implementing Closeable is fine and also works with try-with-resources in Java 7, yes. Have JavaSparkContext implement Closeable/AutoCloseable --- Key: SPARK-3470 URL: https://issues.apache.org/jira/browse/SPARK-3470 Project: Spark Issue Type: New Feature Components: Spark Core Affects Versions: 1.0.2 Reporter: Shay Rojansky Priority: Minor After discussion in SPARK-2972, it seems like a good idea to allow Java developers to use Java 7 automatic resource management with JavaSparkContext, like so: {code:java} try (JavaSparkContext ctx = new JavaSparkContext(...)) { return br.readLine(); } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org