Class StreamingQueryManager
StreamingQuery active in a SparkSession.
- Since:
- 2.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StreamingQuery[]active()Returns a list of active queries associated with this SQLContextabstract voidaddListener(StreamingQueryListener listener) Register aStreamingQueryListenerto receive up-calls for life cycle events ofStreamingQuery.abstract voidWait until any of the queries on the associated SQLContext has terminated since the creation of the context, or sinceresetTerminated()was called.abstract booleanawaitAnyTermination(long timeoutMs) Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or sinceresetTerminated()was called.abstract StreamingQueryReturns the query if there is an active query with the given id, or null.abstract StreamingQueryReturns the query if there is an active query with the given id, or null.abstract StreamingQueryListener[]List allStreamingQueryListeners attached to thisStreamingQueryManager.abstract voidremoveListener(StreamingQueryListener listener) Deregister aStreamingQueryListener.abstract voidForget about past terminated queries so thatawaitAnyTermination()can be used again to wait for new terminations.
-
Constructor Details
-
StreamingQueryManager
public StreamingQueryManager()
-
-
Method Details
-
active
Returns a list of active queries associated with this SQLContext- Returns:
- (undocumented)
- Since:
- 2.0.0
-
addListener
Register aStreamingQueryListenerto receive up-calls for life cycle events ofStreamingQuery.- Parameters:
listener- (undocumented)- Since:
- 2.0.0
-
awaitAnyTermination
Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or sinceresetTerminated()was called. If any query was terminated with an exception, then the exception will be thrown.If a query has terminated, then subsequent calls to
awaitAnyTermination()will either return immediately (if the query was terminated byquery.stop()), or throw the exception immediately (if the query was terminated with exception). UseresetTerminated()to clear past terminations and wait for new terminations.In the case where multiple queries have terminated since
resetTermination()was called, if any query has terminated with exception, thenawaitAnyTermination()will throw any of the exception. For correctly documenting exceptions across multiple queries, users need to stop all of them after any of them terminates with exception, and then check thequery.exception()for each query.- Throws:
StreamingQueryException- if any query has terminated with an exception- Since:
- 2.0.0
-
awaitAnyTermination
Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or sinceresetTerminated()was called. Returns whether any query has terminated or not (multiple may have terminated). If any query has terminated with an exception, then the exception will be thrown.If a query has terminated, then subsequent calls to
awaitAnyTermination()will either returntrueimmediately (if the query was terminated byquery.stop()), or throw the exception immediately (if the query was terminated with exception). UseresetTerminated()to clear past terminations and wait for new terminations.In the case where multiple queries have terminated since
resetTermination()was called, if any query has terminated with exception, thenawaitAnyTermination()will throw any of the exception. For correctly documenting exceptions across multiple queries, users need to stop all of them after any of them terminates with exception, and then check thequery.exception()for each query.- Parameters:
timeoutMs- (undocumented)- Returns:
- (undocumented)
- Throws:
StreamingQueryException- if any query has terminated with an exception- Since:
- 2.0.0
-
get
Returns the query if there is an active query with the given id, or null.- Parameters:
id- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.1.0
-
get
Returns the query if there is an active query with the given id, or null.- Parameters:
id- (undocumented)- Returns:
- (undocumented)
- Since:
- 2.1.0
-
listListeners
List allStreamingQueryListeners attached to thisStreamingQueryManager.- Returns:
- (undocumented)
- Since:
- 3.0.0
-
removeListener
Deregister aStreamingQueryListener.- Parameters:
listener- (undocumented)- Since:
- 2.0.0
-
resetTerminated
public abstract void resetTerminated()Forget about past terminated queries so thatawaitAnyTermination()can be used again to wait for new terminations.- Since:
- 2.0.0
-