public class StreamingQueryManager extends Object implements Logging
StreamingQuery
active in a SparkSession
.
Modifier and Type | Method and Description |
---|---|
StreamingQuery[] |
active()
Returns a list of active queries associated with this SQLContext
|
void |
addListener(StreamingQueryListener listener)
Register a
StreamingQueryListener to receive up-calls for life cycle events of
StreamingQuery . |
void |
awaitAnyTermination()
Wait until any of the queries on the associated SQLContext has terminated since the
creation of the context, or since
resetTerminated() 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 since
resetTerminated() was called. |
StreamingQuery |
get(String id)
Returns the query if there is an active query with the given id, or null.
|
StreamingQuery |
get(java.util.UUID id)
Returns the query if there is an active query with the given id, or null.
|
StreamingQueryListener[] |
listListeners()
List all
StreamingQueryListener s attached to this StreamingQueryManager . |
void |
removeListener(StreamingQueryListener listener)
Deregister a
StreamingQueryListener . |
void |
resetTerminated()
Forget about past terminated queries so that
awaitAnyTermination() can be used again to
wait for new terminations. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeForcefully, initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public StreamingQuery[] active()
public void addListener(StreamingQueryListener listener)
StreamingQueryListener
to receive up-calls for life cycle events of
StreamingQuery
.
listener
- (undocumented)public void awaitAnyTermination() throws StreamingQueryException
resetTerminated()
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 by query.stop()
),
or throw the exception immediately (if the query was terminated with exception). Use
resetTerminated()
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, then awaitAnyTermination()
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 the
query.exception()
for each query.
StreamingQueryException
- if any query has terminated with an exception
public boolean awaitAnyTermination(long timeoutMs) throws StreamingQueryException
resetTerminated()
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
return true
immediately (if the query was terminated by query.stop()
),
or throw the exception immediately (if the query was terminated with exception). Use
resetTerminated()
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, then awaitAnyTermination()
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 the
query.exception()
for each query.
timeoutMs
- (undocumented)StreamingQueryException
- if any query has terminated with an exception
public StreamingQuery get(java.util.UUID id)
id
- (undocumented)public StreamingQuery get(String id)
id
- (undocumented)public StreamingQueryListener[] listListeners()
StreamingQueryListener
s attached to this StreamingQueryManager
.
public void removeListener(StreamingQueryListener listener)
StreamingQueryListener
.
listener
- (undocumented)public void resetTerminated()
awaitAnyTermination()
can be used again to
wait for new terminations.