public class GridCacheQueryAdapter<T> extends Object implements GridCacheQuery<T>
DFLT_PAGE_SIZE| Constructor and Description |
|---|
GridCacheQueryAdapter(GridCacheContext<?,?> cctx,
GridCacheQueryType type,
GridPredicate<GridCacheEntry<Object,Object>> prjPred,
Class<?> cls,
String clause,
GridBiPredicate<Object,Object> filter,
boolean incMeta) |
GridCacheQueryAdapter(GridCacheContext<?,?> cctx,
GridPredicate<GridCacheEntry<Object,Object>> prjPred,
GridCacheQueryType type,
GridLogger log,
int pageSize,
long timeout,
boolean keepAll,
boolean incBackups,
boolean dedup,
GridProjection prj,
GridBiPredicate<Object,Object> filter,
Class<?> cls,
String clause,
boolean incMeta) |
| Modifier and Type | Method and Description |
|---|---|
String |
clause() |
boolean |
enableDedup() |
GridCacheQuery<T> |
enableDedup(boolean dedup)
Sets whether or not to deduplicate query result set.
|
<R> GridCacheQueryFuture<R> |
execute(GridClosure<T,R> rmtTransform,
Object... args)
Executes the query the same way as
GridCacheQuery.execute(Object...) method but transforms result remotely. |
<R> GridCacheQueryFuture<R> |
execute(GridReducer<T,R> rmtReducer,
Object... args)
Executes the query the same way as
GridCacheQuery.execute(Object...) method but reduces result remotely. |
GridCacheQueryFuture<T> |
execute(Object... args)
Executes the query and returns the query future.
|
boolean |
includeBackups() |
GridCacheQuery<T> |
includeBackups(boolean incBackups)
Sets whether or not to include backup entries into query result.
|
boolean |
includeMetadata() |
boolean |
keepAll() |
GridCacheQuery<T> |
keepAll(boolean keepAll)
Sets whether or not to keep all query results local.
|
GridCacheQueryMetrics |
metrics()
Gets metrics for this query.
|
void |
onExecuted(Object res,
Throwable err,
long startTime,
long duration) |
int |
pageSize() |
GridCacheQuery<T> |
pageSize(int pageSize)
Sets result page size.
|
GridProjection |
projection() |
GridCacheQuery<T> |
projection(GridProjection prj)
Sets optional grid projection to execute this query on.
|
GridPredicate<GridCacheEntry<Object,Object>> |
projectionFilter() |
Class<?> |
queryClass() |
void |
resetMetrics()
Resets metrics for this query.
|
<K,V> GridBiPredicate<K,V> |
scanFilter() |
long |
timeout() |
GridCacheQuery<T> |
timeout(long timeout)
Sets query timeout.
|
GridCacheQueryType |
type() |
void |
validate() |
public GridCacheQueryAdapter(GridCacheContext<?,?> cctx, GridCacheQueryType type, @Nullable GridPredicate<GridCacheEntry<Object,Object>> prjPred, @Nullable Class<?> cls, @Nullable String clause, @Nullable GridBiPredicate<Object,Object> filter, boolean incMeta)
cctx - Context.type - Query type.cls - Class.clause - Clause.filter - Scan filter.incMeta - Include metadata flag.prjPred - Cache projection filter.public GridCacheQueryAdapter(GridCacheContext<?,?> cctx, GridPredicate<GridCacheEntry<Object,Object>> prjPred, GridCacheQueryType type, GridLogger log, int pageSize, long timeout, boolean keepAll, boolean incBackups, boolean dedup, GridProjection prj, GridBiPredicate<Object,Object> filter, Class<?> cls, String clause, boolean incMeta)
cctx - Context.prjPred - Cache projection filter.type - Query type.log - Logger.pageSize - Page size.timeout - Timeout.keepAll - Keep all flag.incBackups - Include backups flag.dedup - Enable dedup flag.prj - Grid projection.filter - Key-value filter.cls - Class.clause - Clause.incMeta - Include metadata flag.public GridPredicate<GridCacheEntry<Object,Object>> projectionFilter()
public GridCacheQueryType type()
public boolean includeMetadata()
public GridCacheQuery<T> pageSize(int pageSize)
GridCacheQuery.DFLT_PAGE_SIZE will be used.
Results are returned from queried nodes one page at a tme.pageSize in interface GridCacheQuery<T>pageSize - Page size.this query instance for chaining.public int pageSize()
public GridCacheQuery<T> timeout(long timeout)
0 means there is no timeout (this
is a default value).timeout in interface GridCacheQuery<T>timeout - Query timeout.this query instance for chaining.public long timeout()
public GridCacheQuery<T> keepAll(boolean keepAll)
true.keepAll in interface GridCacheQuery<T>keepAll - Keep results or not.this query instance for chaining.public boolean keepAll()
public GridCacheQuery<T> includeBackups(boolean incBackups)
false by default.includeBackups in interface GridCacheQuery<T>incBackups - Query includeBackups flag.this query instance for chaining.public boolean includeBackups()
public GridCacheQuery<T> enableDedup(boolean dedup)
true
then query result will not contain some key more than once even if several nodes
returned entries with the same keys. Default value is false.enableDedup in interface GridCacheQuery<T>dedup - Query enableDedup flag.this query instance for chaining.public boolean enableDedup()
public GridCacheQuery<T> projection(GridProjection prj)
projection in interface GridCacheQuery<T>prj - Projection.this query instance for chaining.public GridProjection projection()
public <K,V> GridBiPredicate<K,V> scanFilter()
public void validate()
throws GridException
GridException - If query is invalid.public void onExecuted(Object res, Throwable err, long startTime, long duration)
res - Query result.err - Error or null if query executed successfully.startTime - Start time.duration - Duration.public GridCacheQueryFuture<T> execute(@Nullable Object... args)
'get(..)' methods on the returned future. If
GridCacheQuery.keepAll(boolean) flag is set to false, then 'get(..)'
methods will only return the last page received, otherwise all pages will be
accumulated and returned to user as a collection.
Note that if the passed in grid projection is a local node, then query will be executed locally without distribution to other nodes.
Also note that query state cannot be changed (clause, timeout etc.), except arguments, if this method was called at least once.
execute in interface GridCacheQuery<T>args - Optional arguments.public <R> GridCacheQueryFuture<R> execute(GridReducer<T,R> rmtReducer, @Nullable Object... args)
GridCacheQuery.execute(Object...) method but reduces result remotely.execute in interface GridCacheQuery<T>rmtReducer - Remote reducer.args - Optional arguments.public <R> GridCacheQueryFuture<R> execute(GridClosure<T,R> rmtTransform, @Nullable Object... args)
GridCacheQuery.execute(Object...) method but transforms result remotely.execute in interface GridCacheQuery<T>rmtTransform - Remote transformer.args - Optional arguments.public GridCacheQueryMetrics metrics()
GridCacheQuerymetrics in interface GridCacheQuery<T>public void resetMetrics()
GridCacheQueryresetMetrics in interface GridCacheQuery<T>Copyright © 2014. All rights reserved.