Ani*_*uri 11 stream twitter4j apache-spark spark-streaming
我构建了一个从Twitter接收DStreams的应用程序,停止Streaming上下文的唯一方法就是停止执行.我想知道是否有办法设置时间并终止流式套接字而不停止整个应用程序?
你可以使用其中之一
awaitTerminationOrTimeout(long)
Run Code Online (Sandbox Code Playgroud)
如前一个答案中所述,或者您可以从其他线程手动停止流式上下文:
// in the main thread
awaitTermination(); // will wait forever or until the context is stopped
// in another thread
streamingContext.stop();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6305 次 |
| 最近记录: |