GemFire 5.8

com.gemstone.gemfire.cache.query
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:
5.5

Method Summary
 void close()
          Close the CQ and stop execution.
 void execute()
          Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ.
 SelectResults executeWithInitialResults()
          Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ.
 CqAttributes getCqAttributes()
          Get CqAttributes for this CQ.
 CqAttributesMutator getCqAttributesMutator()
          Get CqAttributesMutator for this CQ.
 String getName()
          Get the name of the CQ.
 Query getQuery()
          Get the query object generated for this CQs query.
 String getQueryString()
          Get the original query string that was specified with CQ.
 CqState getState()
          Get the state of the CQ in CqState object form.
 CqStatistics getStatistics()
          Get statistics information for this CQ.
 boolean isClosed()
          This allows to check if the CQ is closed.
 boolean isDurable()
          This allows to check if the CQ is durable.
 boolean isRunning()
          This allows to check if the CQ is in running or active.
 boolean isStopped()
          This allows to check if the CQ is in stopped.
 void stop()
          Stops this CqQuery without releasing resources.
 

Method Detail

getQueryString

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

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

getCqAttributesMutator

CqAttributesMutator getCqAttributesMutator()
Get CqAttributesMutator for this CQ.

Returns:
CqAttributesMutator.
See Also:
CqAttributesMutator

executeWithInitialResults

SelectResults executeWithInitialResults()
                                        throws CqClosedException,
                                               RegionNotFoundException,
                                               CqException
Start executing the CQ or if this CQ is stopped earlier, resumes execution of the CQ. Get the resultset associated with CQ query. The CQ is executed on primary and redundant servers, if CQ execution fails on all the server then a CqException is thrown. In cases when the query is complex and data set is large, this may take long time to get the resultset, in order to take care of this a longer socket read timeout value is set during the execution of this method and is reset back to the previous value after the execution.

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.
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.
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:
IllegalStateException - if the CqQuery is in the STOPPED state already.
CqClosedException - if the CQ is CLOSED.
CqException

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:
5.5

GemFire 5.8

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.