public class GridCacheQueryAdapter<T> extends Object implements CacheQuery<T>
| Constructor and Description |
|---|
GridCacheQueryAdapter(GridCacheContext<?,?> cctx,
GridCacheQueryType type,
IgniteLogger log,
int pageSize,
long timeout,
boolean keepAll,
boolean incBackups,
boolean dedup,
ClusterGroup prj,
IgniteBiPredicate<Object,Object> filter,
Integer part,
String clsName,
String clause,
boolean incMeta,
boolean keepBinary,
UUID subjId,
int taskHash) |
GridCacheQueryAdapter(GridCacheContext<?,?> cctx,
GridCacheQueryType type,
String clsName,
String clause,
IgniteBiPredicate<Object,Object> filter,
Integer part,
boolean incMeta,
boolean keepBinary) |
| Modifier and Type | Method and Description |
|---|---|
String |
clause() |
boolean |
enableDedup() |
CacheQuery<T> |
enableDedup(boolean dedup)
Sets whether or not to deduplicate query result set.
|
<R> CacheQueryFuture<R> |
execute(IgniteClosure<T,R> rmtTransform,
Object... args)
Executes the query the same way as
CacheQuery.execute(Object...) method but transforms result remotely. |
<R> CacheQueryFuture<R> |
execute(IgniteReducer<T,R> rmtReducer,
Object... args)
Executes the query the same way as
CacheQuery.execute(Object...) method but reduces result remotely. |
CacheQueryFuture<T> |
execute(Object... args)
Executes the query and returns the query future.
|
<R extends Map.Entry> |
executeScanQuery() |
boolean |
includeBackups() |
CacheQuery<T> |
includeBackups(boolean incBackups)
Sets whether or not to include backup entries into query result.
|
boolean |
includeMetadata() |
boolean |
keepAll() |
CacheQuery<T> |
keepAll(boolean keepAll)
Sets whether or not to keep all query results local.
|
boolean |
keepBinary() |
void |
keepBinary(boolean keepBinary)
Forces query to keep binary object representation even if query was created on plain projection.
|
QueryMetrics |
metrics()
Gets metrics for this query.
|
void |
onCompleted(Object res,
Throwable err,
long startTime,
long duration) |
int |
pageSize() |
CacheQuery<T> |
pageSize(int pageSize)
Sets result page size.
|
Integer |
partition() |
ClusterGroup |
projection() |
CacheQuery<T> |
projection(ClusterGroup prj)
Sets optional grid projection to execute this query on.
|
String |
queryClassName() |
void |
resetMetrics()
Resets metrics for this query.
|
<K,V> IgniteBiPredicate<K,V> |
scanFilter() |
UUID |
subjectId() |
void |
subjectId(UUID subjId) |
int |
taskHash() |
long |
timeout() |
CacheQuery<T> |
timeout(long timeout)
Sets query timeout.
|
String |
toString() |
GridCacheQueryType |
type() |
void |
validate() |
public GridCacheQueryAdapter(GridCacheContext<?,?> cctx, GridCacheQueryType type, @Nullable String clsName, @Nullable String clause, @Nullable IgniteBiPredicate<Object,Object> filter, @Nullable Integer part, boolean incMeta, boolean keepBinary)
cctx - Context.type - Query type.clsName - Class name.clause - Clause.filter - Scan filter.part - Partition.incMeta - Include metadata flag.keepBinary - Keep binary flag.public GridCacheQueryAdapter(GridCacheContext<?,?> cctx, GridCacheQueryType type, IgniteLogger log, int pageSize, long timeout, boolean keepAll, boolean incBackups, boolean dedup, ClusterGroup prj, IgniteBiPredicate<Object,Object> filter, @Nullable Integer part, @Nullable String clsName, String clause, boolean incMeta, boolean keepBinary, UUID subjId, int taskHash)
cctx - Context.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.part - Partition.clsName - Class name.clause - Clause.incMeta - Include metadata flag.keepBinary - Keep binary flag.subjId - Security subject ID.taskHash - Task hash.public GridCacheQueryType type()
public boolean includeMetadata()
public boolean keepBinary()
True if binary should not be deserialized.public void keepBinary(boolean keepBinary)
keepBinary - Keep binary flag.public UUID subjectId()
public int taskHash()
public void subjectId(UUID subjId)
subjId - Security subject ID.public CacheQuery<T> pageSize(int pageSize)
Query.DFLT_PAGE_SIZE will be used.
Results are returned from queried nodes one page at a tme.pageSize in interface CacheQuery<T>pageSize - Page size.this query instance for chaining.public int pageSize()
public CacheQuery<T> timeout(long timeout)
0 means there is no timeout (this
is a default value).timeout in interface CacheQuery<T>timeout - Query timeout.this query instance for chaining.public long timeout()
public CacheQuery<T> keepAll(boolean keepAll)
true.keepAll in interface CacheQuery<T>keepAll - Keep results or not.this query instance for chaining.public boolean keepAll()
public CacheQuery<T> includeBackups(boolean incBackups)
false by default.includeBackups in interface CacheQuery<T>incBackups - Query includeBackups flag.this query instance for chaining.public boolean includeBackups()
public CacheQuery<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 CacheQuery<T>dedup - Query enableDedup flag.this query instance for chaining.public boolean enableDedup()
public CacheQuery<T> projection(ClusterGroup prj)
projection in interface CacheQuery<T>prj - Projection.this query instance for chaining.public ClusterGroup projection()
@Nullable public <K,V> IgniteBiPredicate<K,V> scanFilter()
public void validate()
throws IgniteCheckedException
IgniteCheckedException - If query is invalid.public void onCompleted(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 CacheQueryFuture<T> execute(@Nullable Object... args)
'get(..)' methods on the returned future. If
CacheQuery.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 CacheQuery<T>args - Optional arguments.public <R> CacheQueryFuture<R> execute(IgniteReducer<T,R> rmtReducer, @Nullable Object... args)
CacheQuery.execute(Object...) method but reduces result remotely.execute in interface CacheQuery<T>rmtReducer - Remote reducer.args - Optional arguments.public <R> CacheQueryFuture<R> execute(IgniteClosure<T,R> rmtTransform, @Nullable Object... args)
CacheQuery.execute(Object...) method but transforms result remotely.execute in interface CacheQuery<T>rmtTransform - Remote transformer.args - Optional arguments.public QueryMetrics metrics()
metrics in interface CacheQuery<T>public void resetMetrics()
resetMetrics in interface CacheQuery<T>public <R extends Map.Entry> GridCloseableIterator<R> executeScanQuery() throws IgniteCheckedException
executeScanQuery in interface CacheQuery<T>IgniteCheckedException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.6.0 Release Date : May 18 2016