Last active
August 29, 2015 14:08
-
-
Save maxtomassi/cd3f5eb8e5c039fd9e8f to your computer and use it in GitHub Desktop.
Gracefully stopping a Spark Streaming application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(args: Array[String]) { | |
| // Prepare your environment | |
| val ssc = new StreamingContext(conf, Seconds(batchDurationInSec)) | |
| // Do your processing | |
| sys.ShutdownHookThread { | |
| log.info("Gracefully stopping Spark Streaming Application") | |
| ssc.stop(true, true) | |
| log.info("Application stopped") | |
| } | |
| ssc.start | |
| ssc.awaitTermination | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried the Java version on spark 1.3 like below, I don't know why it doesn't work?