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 void
addListener
(StreamingQueryListener listener) Register aStreamingQueryListener
to receive up-calls for life cycle events ofStreamingQuery
.abstract void
Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or sinceresetTerminated()
was called.abstract boolean
awaitAnyTermination
(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 StreamingQuery
Returns the query if there is an active query with the given id, or null.abstract StreamingQuery
Returns the query if there is an active query with the given id, or null.abstract StreamingQueryListener[]
List allStreamingQueryListener
s attached to thisStreamingQueryManager
.abstract void
removeListener
(StreamingQueryListener listener) Deregister aStreamingQueryListener
.abstract void
Forget 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 aStreamingQueryListener
to 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 returntrue
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.- 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 allStreamingQueryListener
s 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
-