本文整理汇总了Java中org.apache.ignite.cache.query.ScanQuery.setPageSize方法的典型用法代码示例。如果您正苦于以下问题:Java ScanQuery.setPageSize方法的具体用法?Java ScanQuery.setPageSize怎么用?Java ScanQuery.setPageSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.cache.query.ScanQuery
的用法示例。
在下文中一共展示了ScanQuery.setPageSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testScanQueryNotFullyFetchedMetrics
import org.apache.ignite.cache.query.ScanQuery; //导入方法依赖的package包/类
/**
* Test metrics for Scan queries.
*
* @throws Exception In case of error.
*/
public void testScanQueryNotFullyFetchedMetrics() throws Exception {
IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A");
ScanQuery<Integer, String> qry = new ScanQuery<>();
qry.setPageSize(10);
checkQueryNotFullyFetchedMetrics(cache, qry, true);
}
示例2: scan
import org.apache.ignite.cache.query.ScanQuery; //导入方法依赖的package包/类
/**
* Execute scan query.
*
* @param c Cache to scan.
* @param arg Job argument with query parameters.
* @return Query cursor.
*/
private QueryCursor<Cache.Entry<Object, Object>> scan(IgniteCache<Object, Object> c, VisorScanQueryTaskArg arg,
IgniteBiPredicate<Object, Object> filter) {
ScanQuery<Object, Object> qry = new ScanQuery<>(filter);
qry.setPageSize(arg.getPageSize());
qry.setLocal(arg.isLocal());
return c.withKeepBinary().query(qry);
}
示例3: scanQueryReconnectInProgress
import org.apache.ignite.cache.query.ScanQuery; //导入方法依赖的package包/类
/**
* @param setPart If {@code true} sets partition for scan query.
* @throws Exception If failed.
*/
private void scanQueryReconnectInProgress(boolean setPart) throws Exception {
Ignite cln = grid(serverCount());
assertTrue(cln.cluster().localNode().isClient());
final Ignite srv = clientRouter(cln);
final IgniteCache<Integer, Person> clnCache = cln.getOrCreateCache(QUERY_CACHE);
clnCache.put(1, new Person(1, "name1", "surname1"));
clnCache.put(2, new Person(2, "name2", "surname2"));
clnCache.put(3, new Person(3, "name3", "surname3"));
final ScanQuery<Integer, Person> scanQry = new ScanQuery<>();
scanQry.setPageSize(1);
scanQry.setFilter(new IgniteBiPredicate<Integer, Person>() {
@Override public boolean apply(Integer integer, Person person) {
return true;
}
});
if (setPart)
scanQry.setPartition(1);
blockMessage(GridCacheQueryResponse.class);
final IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
@Override public Object call() throws Exception {
try {
QueryCursor<Cache.Entry<Integer, Person>> qryCursor = clnCache.query(scanQry);
qryCursor.getAll();
}
catch (CacheException e) {
checkAndWait(e);
return true;
}
return false;
}
});
// Check that client waiting operation.
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
return fut.get(200);
}
}, IgniteFutureTimeoutCheckedException.class, null);
assertNotDone(fut);
unblockMessage();
reconnectClientNode(cln, srv, null);
assertTrue((Boolean)fut.get(2, SECONDS));
QueryCursor<Cache.Entry<Integer, Person>> qryCursor2 = clnCache.query(scanQry);
List<Cache.Entry<Integer, Person>> entries = qryCursor2.getAll();
assertEquals(setPart ? 1 : 3, entries.size());
for (Cache.Entry<Integer, Person> entry : entries) {
assertEquals(Integer.class, entry.getKey().getClass());
assertEquals(Person.class, entry.getValue().getClass());
}
}