Class StreamingQueryManager
- All Implemented Interfaces:
org.apache.spark.internal.Logging
StreamingQuery
active in a SparkSession
.
- Since:
- 2.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging
org.apache.spark.internal.Logging.SparkShellLoggingFilter
-
Method Summary
Modifier and TypeMethodDescriptionactive()
Returns a list of active queries associated with this SQLContextvoid
addListener
(StreamingQueryListener listener) Register aStreamingQueryListener
to receive up-calls for life cycle events ofStreamingQuery
.void
Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or sinceresetTerminated()
was called.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.Returns the query if there is an active query with the given id, or null.Returns the query if there is an active query with the given id, or null.List allStreamingQueryListener
s attached to thisStreamingQueryManager
.void
removeListener
(StreamingQueryListener listener) Deregister aStreamingQueryListener
.void
Forget about past terminated queries so thatawaitAnyTermination()
can be used again to wait for new terminations.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.spark.internal.Logging
initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq
-
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 void resetTerminated()Forget about past terminated queries so thatawaitAnyTermination()
can be used again to wait for new terminations.- Since:
- 2.0.0
-