ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr.query
Interface CancellableQuery


public interface CancellableQuery

A simple interface that allows tracking an executing query that can be cancelled.


Method Summary
 boolean cancel()
          Cancel the query if it is currently running.
 QueryResults getResults()
          Execute the query and get the results.
 

Method Detail

getResults

QueryResults getResults()
                        throws QueryCancelledException,
                               RepositoryException
Execute the query and get the results. Note that this method can be called by multiple threads, and all will block until the query execution has completed. Subsequent calls to this method will return the same results.

Returns:
the query results.
Throws:
QueryCancelledException - if the query was cancelled
RepositoryException - if there was a problem executing the query

cancel

boolean cancel()
Cancel the query if it is currently running. Note that this method does not block until the query is cancelled; it merely marks the query as being cancelled, and the query will terminate at its next available opportunity. Also, subsequent calls to this method have no affect.

Returns:
true if the query was executing and will be cancelled, or false if the query was no longer running (because it had finished successfully or had already been cancelled) and could not be cancelled.

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.