R
- Result type.public abstract class GridCacheQueryFutureAdapter<K,V,R> extends GridFutureAdapter<Collection<R>> implements CacheQueryFuture<R>, GridTimeoutObject
Modifier and Type | Field and Description |
---|---|
protected GridCacheContext<K,V> |
cctx
Cache context.
|
protected boolean |
loc |
protected static IgniteLogger |
log
Logger.
|
protected GridCacheQueryBean |
qry |
Modifier | Constructor and Description |
---|---|
protected |
GridCacheQueryFutureAdapter() |
protected |
GridCacheQueryFutureAdapter(GridCacheContext<K,V> cctx,
GridCacheQueryBean qry,
boolean loc) |
Modifier and Type | Method and Description |
---|---|
abstract void |
awaitFirstPage()
Waits for the first page to be received from remote node(s), if any.
|
boolean |
cancel()
Default no-op implementation that always returns
false . |
protected abstract void |
cancelQuery() |
void |
close() |
long |
endTime() |
protected void |
enqueue(Collection<?> col) |
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.
|
protected abstract void |
loadAllPages()
Loads all left pages.
|
protected abstract void |
loadPage()
Loads next page.
|
R |
next()
Returns next element from result set.
|
Collection<R> |
nextPage()
Returns next page for the query.
|
Collection<R> |
nextPage(long timeout)
Returns next page for the query.
|
boolean |
onDone(Collection<R> res,
Throwable err)
Callback to notify that future is finished.
|
protected void |
onNodeLeft(UUID evtNodeId) |
protected abstract boolean |
onPage(UUID nodeId,
boolean last) |
void |
onPage(UUID nodeId,
Collection<?> data,
Throwable err,
boolean finished) |
void |
onTimeout()
Timeout callback.
|
void |
printMemoryStats() |
GridCacheQueryBean |
query() |
IgniteUuid |
timeoutId() |
String |
toString() |
chain, chain, error, get, ignoreInterrupts, isCancelled, isDone, isFailed, listen, logger, onCancelled, onDone, onDone, onDone, onDone, reset, result
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isDone
chain, chain, error, get, isCancelled, listen, result
protected static IgniteLogger log
protected GridCacheContext<K,V> cctx
protected final GridCacheQueryBean qry
protected boolean loc
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 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 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 abstract void awaitFirstPage() throws IgniteCheckedException
IgniteCheckedException
- If query execution failed with an error.public Collection<R> nextPage() throws IgniteCheckedException
null
if no more pages available.IgniteCheckedException
- If fetch failed.public Collection<R> nextPage(long timeout) throws IgniteCheckedException
timeout
- Timeout.null
if no more pages available.IgniteCheckedException
- If fetch failed.protected void onNodeLeft(UUID evtNodeId)
evtNodeId
- Removed or failed node Id.protected void enqueue(Collection<?> col)
col
- Collection.public void onPage(@Nullable UUID nodeId, @Nullable Collection<?> data, @Nullable Throwable err, boolean finished)
nodeId
- Sender node.data
- Page data.err
- Error (if was).finished
- Finished or not.public Collection<R> get() throws IgniteCheckedException
get
in interface IgniteInternalFuture<Collection<R>>
get
in class GridFutureAdapter<Collection<R>>
IgniteInterruptedCheckedException
- Subclass of IgniteCheckedException
thrown if the wait was interrupted.IgniteFutureCancelledCheckedException
- Subclass of IgniteCheckedException
throws if computation was cancelled.IgniteCheckedException
- If computation failed.public Collection<R> get(long timeout, TimeUnit unit) throws IgniteCheckedException
get
in interface IgniteInternalFuture<Collection<R>>
get
in class GridFutureAdapter<Collection<R>>
timeout
- The maximum time to wait.unit
- The time unit of the timeout
argument.IgniteInterruptedCheckedException
- Subclass of IgniteCheckedException
thrown if the wait was interrupted.IgniteFutureTimeoutCheckedException
- Subclass of IgniteCheckedException
thrown if the wait was timed out.IgniteFutureCancelledCheckedException
- Subclass of IgniteCheckedException
throws if computation was cancelled.IgniteCheckedException
- If computation failed.public Collection<R> getUninterruptibly() throws IgniteCheckedException
getUninterruptibly
in interface IgniteInternalFuture<Collection<R>>
getUninterruptibly
in class GridFutureAdapter<Collection<R>>
IgniteFutureCancelledCheckedException
- Subclass of IgniteCheckedException
throws if computation
was cancelled.IgniteCheckedException
- If computation failed.protected abstract boolean onPage(UUID nodeId, boolean last)
nodeId
- Sender node id.last
- Whether page is last.protected abstract void loadPage()
protected abstract void loadAllPages() throws IgniteInterruptedCheckedException
IgniteInterruptedCheckedException
- If thread is interrupted.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() throws IgniteCheckedException
IgniteCheckedException
- In case of error.public IgniteUuid timeoutId()
timeoutId
in interface GridTimeoutObject
public long endTime()
endTime
in interface GridTimeoutObject
public void onTimeout()
onTimeout
in interface GridTimeoutObject
public void close() throws Exception
close
in interface AutoCloseable
Exception
public String toString()
toString
in class GridFutureAdapter<Collection<R>>
public void printMemoryStats()
Follow @ApacheIgnite
Ignite Fabric : ver. 2.3.0 Release Date : October 28 2017