Class GridCacheDistributedQueryFuture<K,V,R>
- java.lang.Object
-
- org.apache.ignite.internal.util.future.GridFutureAdapter<Collection<R>>
-
- org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter<K,V,R>
-
- org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryFuture<K,V,R>
-
- All Implemented Interfaces:
AutoCloseable,IgniteInternalFuture<Collection<R>>,CacheQueryFuture<R>,GridTimeoutObject
- Direct Known Subclasses:
GridCacheDistributedFieldsQueryFuture
public class GridCacheDistributedQueryFuture<K,V,R> extends GridCacheQueryFutureAdapter<K,V,R>
Distributed query future.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridCacheDistributedQueryFuture(GridCacheContext<K,V> ctx, long reqId, GridCacheQueryBean qry, Collection<ClusterNode> nodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitFirstItemAvailable()TODO: IGNITE-15728 Provide custom reducer for ScanQueryFallbackClosableIterator.protected voidcancelQuery(Throwable err)Cancels query on remote nodes and cleanes owned resources.Collection<R>get()Synchronously waits for completion of the computation and returns computation result.Collection<R>get(long timeout, TimeUnit unit)Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.Collection<R>getUninterruptibly()Synchronously waits for completion of the computation and returns computation result ignoring interrupts.booleanonDone(Collection<R> res, Throwable err)Callback to notify that future is finished.protected voidonError(Throwable err)Invokes in case of this future error.protected voidonMeta(IndexQueryResultMeta metaData)Handles query meta data from query node.protected voidonNodeLeft(UUID nodeId)Callback that invoked in case of a node left cluster.protected voidonPage(UUID nodeId, Collection<R> data, boolean last)Handles new data page from query node.voidstartQuery()Send initial query request to query nodes.-
Methods inherited from class org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter
cacheContext, cancel, close, endTime, fields, logger, next, onPage, onTimeout, query, timeoutId, toString
-
Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter
chain, chain, chain, chain, chainCompose, chainCompose, error, get, ignoreInterrupts, isCancelled, isDone, isFailed, listen, listen, onCancelled, onDone, onDone, onDone, onDone, reset, result
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.query.CacheQueryFuture
isDone
-
Methods inherited from interface org.apache.ignite.internal.IgniteInternalFuture
chain, chain, chain, chain, chainCompose, chainCompose, error, get, isCancelled, listen, listen, result
-
-
-
-
Constructor Detail
-
GridCacheDistributedQueryFuture
protected GridCacheDistributedQueryFuture(GridCacheContext<K,V> ctx, long reqId, GridCacheQueryBean qry, Collection<ClusterNode> nodes)
- Parameters:
ctx- Cache context.reqId- Request ID.qry- Query.
-
-
Method Detail
-
cancelQuery
protected void cancelQuery(Throwable err)
Cancels query on remote nodes and cleanes owned resources.- Specified by:
cancelQueryin classGridCacheQueryFutureAdapter<K,V,R>- Parameters:
err- If query was cancelled with error.
-
onNodeLeft
protected void onNodeLeft(UUID nodeId)
Callback that invoked in case of a node left cluster.- Overrides:
onNodeLeftin classGridCacheQueryFutureAdapter<K,V,R>- Parameters:
nodeId- Removed or failed node Id.
-
onPage
protected void onPage(UUID nodeId, Collection<R> data, boolean last)
Handles new data page from query node.- Specified by:
onPagein classGridCacheQueryFutureAdapter<K,V,R>
-
onMeta
protected void onMeta(IndexQueryResultMeta metaData)
Handles query meta data from query node.- Overrides:
onMetain classGridCacheQueryFutureAdapter<K,V,R>
-
awaitFirstItemAvailable
public void awaitFirstItemAvailable() throws IgniteCheckedExceptionTODO: IGNITE-15728 Provide custom reducer for ScanQueryFallbackClosableIterator. Waits for the first item is available to return.- Specified by:
awaitFirstItemAvailablein classGridCacheQueryFutureAdapter<K,V,R>- Throws:
IgniteCheckedException- If query execution failed with an error.
-
get
public Collection<R> get() throws IgniteCheckedException
Synchronously waits for completion of the computation and returns computation result.- Specified by:
getin interfaceIgniteInternalFuture<K>- Overrides:
getin classGridFutureAdapter<Collection<R>>- Returns:
- Computation result.
- Throws:
IgniteInterruptedCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was interrupted.IgniteFutureCancelledCheckedException- Subclass ofIgniteCheckedExceptionthrows if computation was cancelled.IgniteCheckedException- If computation failed.
-
get
public Collection<R> get(long timeout, TimeUnit unit) throws IgniteCheckedException
Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.- Specified by:
getin interfaceIgniteInternalFuture<K>- Overrides:
getin classGridFutureAdapter<Collection<R>>- Parameters:
timeout- The maximum time to wait.unit- The time unit of thetimeoutargument.- Returns:
- Computation result.
- Throws:
IgniteInterruptedCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was interrupted.IgniteFutureTimeoutCheckedException- Subclass ofIgniteCheckedExceptionthrown if the wait was timed out.IgniteFutureCancelledCheckedException- Subclass ofIgniteCheckedExceptionthrows if computation was cancelled.IgniteCheckedException- If computation failed.
-
getUninterruptibly
public Collection<R> getUninterruptibly() throws IgniteCheckedException
Synchronously waits for completion of the computation and returns computation result ignoring interrupts.- Specified by:
getUninterruptiblyin interfaceIgniteInternalFuture<K>- Overrides:
getUninterruptiblyin classGridFutureAdapter<Collection<R>>- Returns:
- Computation result.
- Throws:
IgniteFutureCancelledCheckedException- Subclass ofIgniteCheckedExceptionthrows if computation was cancelled.IgniteCheckedException- If computation failed.
-
startQuery
public void startQuery()
Send initial query request to query nodes.
-
onError
protected void onError(Throwable err)
Invokes in case of this future error.- Specified by:
onErrorin classGridCacheQueryFutureAdapter<K,V,R>
-
onDone
public boolean onDone(Collection<R> res, Throwable err)
Callback to notify that future is finished. Note that if non-nullexception is passed in the result value will be ignored.- Overrides:
onDonein classGridCacheQueryFutureAdapter<K,V,R>- Parameters:
res- Optional result.err- Optional error.- Returns:
Trueif result was set by this call.
-
-