R - Result type.public abstract class GridCacheQueryFutureAdapter<K,V,R> extends GridFutureAdapter<Collection<R>> implements CacheQueryFuture<R>, GridTimeoutObject
Iterator interface to
access result data. Handling of recieved pages is triggered by Iterator methods.
Reducing of result data (order, limit) is controlled by CacheQueryReducer.| Modifier and Type | Field and Description |
|---|---|
protected GridCacheContext<K,V> |
cctx
Cache context.
|
protected boolean |
loc |
protected static IgniteLogger |
log
Logger.
|
protected GridCacheQueryBean |
qry |
protected CacheQueryReducer<R> |
reducer
Reducer of cache query results.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GridCacheQueryFutureAdapter() |
protected |
GridCacheQueryFutureAdapter(GridCacheContext<K,V> cctx,
GridCacheQueryBean qry,
boolean loc) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
awaitFirstItemAvailable()
TODO: IGNITE-15728 Provide custom reducer for ScanQueryFallbackClosableIterator.
|
GridCacheContext<K,V> |
cacheContext() |
boolean |
cancel()
Default no-op implementation that always returns
false. |
protected abstract void |
cancelQuery(Throwable err)
Cancels query on remote nodes and cleanes owned resources.
|
void |
close() |
long |
endTime() |
boolean |
fields() |
IgniteLogger |
logger() |
R |
next()
Returns next element from result set.
|
boolean |
onDone(Collection<R> res,
Throwable err)
Callback to notify that future is finished.
|
protected abstract void |
onError(Throwable err)
Invokes in case of this future error.
|
protected void |
onMeta(IndexQueryResultMeta meta)
Handles query meta data from query node.
|
protected void |
onNodeLeft(UUID evtNodeId)
Callback that invoked in case of a node left cluster.
|
protected abstract void |
onPage(UUID nodeId,
Collection<R> data,
boolean lastPage)
Handles new data page from query node.
|
void |
onPage(@Nullable UUID nodeId,
@Nullable IndexQueryResultMeta metadata,
@Nullable Collection<?> data,
@Nullable Throwable err,
boolean lastPage)
Entrypoint for handling query result page from remote node.
|
void |
onTimeout()
Timeout callback.
|
GridCacheQueryBean |
query() |
IgniteUuid |
timeoutId() |
String |
toString() |
chain, chain, chainCompose, chainCompose, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, onCancelled, onDone, onDone, onDone, onDone, reset, resultclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisDonechain, chain, chainCompose, chainCompose, error, get, get, get, getUninterruptibly, isCancelled, listen, resultprotected static IgniteLogger log
protected GridCacheContext<K,V> cctx
protected final GridCacheQueryBean qry
protected boolean loc
protected CacheQueryReducer<R> reducer
protected GridCacheQueryFutureAdapter()
protected GridCacheQueryFutureAdapter(GridCacheContext<K,V> cctx, GridCacheQueryBean qry, boolean loc)
cctx - Context.qry - Query.loc - Local query or not.public GridCacheQueryBean query()
public IgniteLogger logger()
logger in class GridFutureAdapter<Collection<R>>public boolean fields()
public R next()
This is a blocking call which will wait if there are no elements available immediately.
next in interface CacheQueryFuture<R>null if all the elements have been fetched.public GridCacheContext<K,V> cacheContext()
public abstract void awaitFirstItemAvailable()
throws IgniteCheckedException
IgniteCheckedException - If query execution failed with an error.protected void onNodeLeft(UUID evtNodeId)
evtNodeId - Removed or failed node Id.public void onPage(@Nullable
@Nullable UUID nodeId,
@Nullable
@Nullable IndexQueryResultMeta metadata,
@Nullable
@Nullable Collection<?> data,
@Nullable
@Nullable Throwable err,
boolean lastPage)
nodeId - Sender node.metadata - Query response metadata.data - Page data.err - Error (if was).lastPage - Whether it is the last page for sender node.protected abstract void onError(Throwable err)
protected abstract void onPage(UUID nodeId, Collection<R> data, boolean lastPage)
protected void onMeta(IndexQueryResultMeta meta)
public boolean onDone(Collection<R> res, Throwable err)
null exception is passed in
the result value will be ignored.onDone in class GridFutureAdapter<Collection<R>>res - Optional result.err - Optional error.True if result was set by this call.public boolean cancel()
throws IgniteCheckedException
false.
Futures that do support cancellation should override this method
and call GridFutureAdapter.onCancelled() callback explicitly if cancellation
indeed did happen.cancel in interface IgniteInternalFuture<Collection<R>>cancel in interface CacheQueryFuture<R>cancel in class GridFutureAdapter<Collection<R>>True if future was canceled (i.e. was not finished prior to this call).IgniteCheckedException - If cancellation failed.protected abstract void cancelQuery(Throwable err) throws IgniteCheckedException
err - If query was cancelled with error.IgniteCheckedException - In case of error.public IgniteUuid timeoutId()
timeoutId in interface GridTimeoutObjectpublic long endTime()
endTime in interface GridTimeoutObjectpublic void onTimeout()
onTimeout in interface GridTimeoutObjectpublic void close()
throws Exception
close in interface AutoCloseableExceptionpublic String toString()
toString in class GridFutureAdapter<Collection<R>>
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023