Class StreamingQueryManager

Object
org.apache.spark.sql.streaming.StreamingQueryManager

public abstract class StreamingQueryManager extends Object
A class to manage all the StreamingQuery active in a SparkSession.

Since:
2.0.0
  • Constructor Details

    • StreamingQueryManager

      public StreamingQueryManager()
  • Method Details

    • active

      public abstract StreamingQuery[] active()
      Returns a list of active queries associated with this SQLContext

      Returns:
      (undocumented)
      Since:
      2.0.0
    • addListener

      public abstract void addListener(StreamingQueryListener listener)
      Register a StreamingQueryListener to receive up-calls for life cycle events of StreamingQuery.

      Parameters:
      listener - (undocumented)
      Since:
      2.0.0
    • awaitAnyTermination

      public abstract void awaitAnyTermination() throws StreamingQueryException
      Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or since 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.

      Throws:
      StreamingQueryException - if any query has terminated with an exception
      Since:
      2.0.0
    • awaitAnyTermination

      public abstract boolean awaitAnyTermination(long timeoutMs) throws StreamingQueryException
      Wait until any of the queries on the associated SQLContext has terminated since the creation of the context, or since 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.

      Parameters:
      timeoutMs - (undocumented)
      Returns:
      (undocumented)
      Throws:
      StreamingQueryException - if any query has terminated with an exception
      Since:
      2.0.0
    • get

      public abstract StreamingQuery get(UUID id)
      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

      public abstract StreamingQuery get(String id)
      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

      public abstract StreamingQueryListener[] listListeners()
      List all StreamingQueryListeners attached to this StreamingQueryManager.

      Returns:
      (undocumented)
      Since:
      3.0.0
    • removeListener

      public abstract void removeListener(StreamingQueryListener listener)
      Deregister a StreamingQueryListener.

      Parameters:
      listener - (undocumented)
      Since:
      2.0.0
    • resetTerminated

      public abstract void resetTerminated()
      Forget about past terminated queries so that awaitAnyTermination() can be used again to wait for new terminations.

      Since:
      2.0.0