当前位置: 首页>>代码示例>>Java>>正文


Java ScanQuery.setPageSize方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:CacheAbstractQueryMetricsSelfTest.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:VisorScanQueryTask.java

示例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());
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:76,代码来源:IgniteClientReconnectQueriesTest.java


注:本文中的org.apache.ignite.cache.query.ScanQuery.setPageSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。