Interface CqQuery


  • public interface CqQuery
    Interface for continuous query. This provides methods for managing a CQ once it is created through the QueryService. The methods allow you to retrieve CQ related information, operate on CQ like execute, stop, close and get the state of the CQ.
    Since:
    GemFire 5.5
    • Method Detail

      • getQueryString

        java.lang.String getQueryString()
        Get the original query string that was specified with CQ.
        Returns:
        String the query string associated with CQ.
      • getQuery

        Query getQuery()
        Get the query object generated for this CQs query.
        Returns:
        Query query object for the query string.
      • getName

        java.lang.String getName()
        Get the name of the CQ.
        Returns:
        the name of the CQ.
      • getStatistics

        CqStatistics getStatistics()
        Get statistics information for this CQ.
        Returns:
        CqStatistics CQ statistics object.
      • getCqAttributes

        CqAttributes getCqAttributes()
        Get CqAttributes for this CQ.
        Returns:
        CqAttributes cqAttribute set with this CqQuery.
        See Also:
        CqAttributes
      • executeWithInitialResults

        <E> CqResults<E> executeWithInitialResults()
                                            throws CqClosedException,
                                                   RegionNotFoundException,
                                                   CqException
        Starts executing the CQ or, if the CQ is in a stopped state, resumes execution. Gets the current resultset for the CQ query. The CQ is executed on the primary server, and then redundant servers as needed. If execution fails on all servers, a CqException is thrown. If the query is complex and the data set is large, this execution may take a long time, which may cause a socket read timeout in the client. To allow adequate time, you may need to set a longer pool read-timeout in the client.
        Type Parameters:
        E - the type contained in the returned CqResults
        Returns:
        SelectResults resultset obtained by executing the query.
        Throws:
        CqClosedException - if this CqQuery is closed.
        RegionNotFoundException - if the specified region in the query string is not found.
        java.lang.IllegalStateException - if the CqQuery is in the RUNNING state already.
        CqException - if failed to execute and get initial results.
      • execute

        void execute()
              throws CqClosedException,
                     RegionNotFoundException,
                     CqException
        Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ. The CQ is executed on primary and redundant servers, if CQ execution fails on all the server then a CqException is thrown.
        Throws:
        CqClosedException - if this CqQuery is closed.
        RegionNotFoundException - if the specified region in the query string is not found.
        java.lang.IllegalStateException - if the CqQuery is in the RUNNING state already.
        CqException - if failed to execute.
      • stop

        void stop()
           throws CqClosedException,
                  CqException
        Stops this CqQuery without releasing resources. Puts the CqQuery into the STOPPED state. Can be resumed by calling execute or executeWithInitialResults.
        Throws:
        java.lang.IllegalStateException - if the CqQuery is in the STOPPED state already.
        CqClosedException - if the CQ is CLOSED.
        CqException - if failed to stop.
      • getState

        CqState getState()
        Get the state of the CQ in CqState object form. CqState supports methods like isClosed(), isRunning(), isStopped().
        Returns:
        CqState state object of the CQ.
        See Also:
        CqState
      • close

        void close()
            throws CqClosedException,
                   CqException
        Close the CQ and stop execution. Releases the resources associated with this CqQuery.
        Throws:
        CqClosedException - Further calls on this CqQuery instance except for getState() or getName().
        CqException - - if failure during cleanup of CQ resources.
      • isRunning

        boolean isRunning()
        This allows to check if the CQ is in running or active.
        Returns:
        boolean true if running, false otherwise
      • isStopped

        boolean isStopped()
        This allows to check if the CQ is in stopped.
        Returns:
        boolean true if stopped, false otherwise
      • isClosed

        boolean isClosed()
        This allows to check if the CQ is closed.
        Returns:
        boolean true if closed, false otherwise
      • isDurable

        boolean isDurable()
        This allows to check if the CQ is durable.
        Returns:
        boolean true if durable, false otherwise
        Since:
        GemFire 5.5