Last active
January 24, 2019 17:13
-
-
Save rssanders3/46bc496d777092e4a6393a948dd3b165 to your computer and use it in GitHub Desktop.
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
| var TRIGGER_STOP = false | |
| var ssc: StreamingContext = … | |
| // Define Stream Creation, Transformations and Actions here. | |
| ssc.start() | |
| var isStopped = false | |
| while (!isStopped) { | |
| isStopped = ssc.awaitTerminationOrTimeout(SPARK_SHUTDOWN_CHECK_MILLIS) | |
| if (isStopped) | |
| LOGGER.info("The Spark Streaming context is stopped. Exiting application...") | |
| else | |
| LOGGER.info("Streaming App is still running. Timeout...") | |
| checkShutdownMarker(ssc, SPARK_SHUTDOWN_RUNNING_MARKER_TOUCH_FILE_LOCATION) | |
| if (!isStopped && TRIGGER_STOP) { | |
| LOGGER.info("Stopping the ssc Spark Streaming Context...") | |
| ssc.stop(stopSparkContext = true, stopGracefully = true) | |
| LOGGER.info("Spark Streaming Context is Stopped!") | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment