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


Java Result.next方法代码示例

本文整理汇总了Java中org.apache.gora.query.Result.next方法的典型用法代码示例。如果您正苦于以下问题:Java Result.next方法的具体用法?Java Result.next怎么用?Java Result.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.gora.query.Result的用法示例。


在下文中一共展示了Result.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findStartNode

import org.apache.gora.query.Result; //导入方法依赖的package包/类
private static CINode findStartNode(Random rand, DataStore<Long,CINode> store) throws IOException {
  Query<Long,CINode> query = store.newQuery();
  query.setStartKey(rand.nextLong());
  query.setLimit(1);
  query.setFields(PREV_FIELD);
  
  long t1 = System.currentTimeMillis();
  Result<Long,CINode> rs = store.execute(query);
  long t2 = System.currentTimeMillis();
  
  try {
    if (rs.next()) {
      LOG.info("FSR %d %016x\n {}", new Object[] {t2 - t1, rs.getKey()});
      return rs.get();
    }
  } catch (Exception e) {
    LOG.error(e.getMessage());
    throw new RuntimeException(e);
  }
  
  LOG.info("FSR {}", new Object [] {(t2 - t1)});
  
  return null;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:25,代码来源:Walker.java

示例2: testSerdeWebPage

import org.apache.gora.query.Result; //导入方法依赖的package包/类
/**
 * Creates an WebPage object in-memory setting several fields to dirty. 
 * Run a query over the persistent data.
 * Asserts that the results can be serialized and 
 * deserialzed without loosing data. We do this by asserting
 * what we get 'before' and 'after' (de)serialization processes.
 * Also simple assertion for equal number of URL's in WebPage 
 * and results.
 * @throws Exception
 */
@SuppressWarnings("unchecked")
@Test
public void testSerdeWebPage() throws Exception {

  MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
      MemStore.class, String.class, WebPage.class, new Configuration());
  WebPageDataCreator.createWebPageData(store);

  Result<String, WebPage> result = store.newQuery().execute();

  int i = 0;
  while (result.next()) {
    WebPage page = result.get();
    TestIOUtils.testSerializeDeserialize(page);
    i++;
  }
  assertEquals(WebPageDataCreator.URLS.length, i);
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:29,代码来源:TestPersistentSerialization.java

示例3: get

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Override
public T get(K key, String[] fields) {
  CassandraQuery<K,T> query = new CassandraQuery<>();
  query.setDataStore(this);
  query.setKeyRange(key, key);
  
  if (fields == null){
    fields = this.getFields();
  }
  query.setFields(fields);

  query.setLimit(1);
  Result<K,T> result = execute(query);
  boolean hasResult = false;
  try {
    hasResult = result.next();
  } catch (Exception e) {
    LOG.error(e.getMessage());
    throw new RuntimeException(e);
  }
  return hasResult ? result.get() : null;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:23,代码来源:CassandraStore.java

示例4: get

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Override
public T get(K key, String[] fields) {
   LOG.debug("get("+key+","+fields+")");
   if (fields==null)
      return infinispanClient.get(key);

   InfinispanQuery query = new InfinispanQuery(this);
   query.setKey(key);
   query.setFields(fields);
   query.build();


   Result<K,T> result = query.execute();
   try {
      result.next();
      return result.get();
   } catch (Exception e) {
      throw new RuntimeException(e);
   }
}
 
开发者ID:leads-project,项目名称:gora-infinispan,代码行数:21,代码来源:InfinispanStore.java

示例5: testCloneWebPage

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Test
public void testCloneWebPage() throws Exception {
  @SuppressWarnings("unchecked")
  DataStore<String, WebPage> store = DataStoreFactory.createDataStore(
      MemStore.class, String.class, WebPage.class, conf);
  WebPageDataCreator.createWebPageData(store);

  Query<String, WebPage> query = store.newQuery();
  Result<String, WebPage> result = query.execute();
  
  int tested = 0;
  while(result.next()) {
    WebPage page = result.get();
    testClone(page);
    tested++;
  }
  Assert.assertEquals(WebPageDataCreator.URLS.length, tested);
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:19,代码来源:TestPersistentDatumReader.java

示例6: get

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Override
public T get(K key, String[] fields) {
  LOG.debug("get("+key+","+fields+")");
  if (fields==null)
    return infinispanClient.get(key);

  InfinispanQuery<K, T> query = new InfinispanQuery<K, T>(this);
  query.setKey(key);
  query.setFields(fields);
  query.build();


  Result<K,T> result = query.execute();
  try {
    result.next();
    return result.get();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:21,代码来源:InfinispanStore.java

示例7: testSerdeWebPage

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testSerdeWebPage() throws Exception {

  MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
      MemStore.class, String.class, WebPage.class, new Configuration());
  WebPageDataCreator.createWebPageData(store);

  Result<String, WebPage> result = store.newQuery().execute();

  int i=0;
  while(result.next()) {
    WebPage page = result.get();
    TestIOUtils.testSerializeDeserialize(page);
    i++;
  }
  Assert.assertEquals(WebPageDataCreator.URLS.length, i);
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:19,代码来源:TestPersistentSerialization.java

示例8: deleteByQuery

import org.apache.gora.query.Result; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @param query matching records to this query will be deleted
 * @return the number of deleted records
 */
@Override
public long deleteByQuery(Query<K, T> query) {
  Result<K, T> result = query.execute();
  int deleteCount = 0;
  try {
    while (result.next()) {
      if (aerospikeClient.delete(null, getAerospikeKey(result.getKey()))) {
        deleteCount++;
      }
    }
    return deleteCount;
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
    return -1;
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:23,代码来源:AerospikeStore.java

示例9: deleteByQuery

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Override
 public long deleteByQuery(Query<K, T> query) {
try{
	long deletedRows = 0;
    Result<K,T> result = query.execute();

    while(result.next()) {
      if(delete(result.getKey()))
        deletedRows++;
    }
    return 0;
  }
catch(Exception e){
	  return 0;
}
 }
 
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:17,代码来源:MemStore.java

示例10: testCloneWebPage

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Test
public void testCloneWebPage() throws Exception {
  @SuppressWarnings("unchecked")
  DataStore<String, WebPage> store = DataStoreFactory.createDataStore(
      MemStore.class, String.class, WebPage.class, conf);
  WebPageDataCreator.createWebPageData(store);

  Query<String, WebPage> query = store.newQuery();
  Result<String, WebPage> result = query.execute();
  
  int tested = 0;
  while(result.next()) {
    WebPage page = result.get();
    testClone(page);
    tested++;
  }
  assertEquals(WebPageDataCreator.URLS.length, tested);
}
 
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:19,代码来源:TestPersistentDatumReader.java

示例11: testSerdeWebPage

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testSerdeWebPage() throws Exception {

  MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
      MemStore.class, String.class, WebPage.class, new Configuration());
  WebPageDataCreator.createWebPageData(store);

  Result<String, WebPage> result = store.newQuery().execute();

  int i=0;
  while(result.next()) {
    WebPage page = result.get();
    TestIOUtils.testSerializeDeserialize(page);
    i++;
  }
  assertEquals(WebPageDataCreator.URLS.length, i);
}
 
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:19,代码来源:TestPersistentSerialization.java

示例12: get

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Override
public T get(K key, String[] fields) {
  CassandraQuery<K,T> query = new CassandraQuery<K,T>();
  query.setDataStore(this);
  query.setKeyRange(key, key);
  query.setFields(fields);
  query.setLimit(1);
  Result<K,T> result = execute(query);
  boolean hasResult = false;
  try {
    hasResult = result.next();
  } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return hasResult ? result.get() : null;
}
 
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:18,代码来源:CassandraStore.java

示例13: readFlushed

import org.apache.gora.query.Result; //导入方法依赖的package包/类
private void readFlushed(Configuration conf) throws Exception {
  DataStore<Utf8,Flushed> flushedTable = DataStoreFactory.getDataStore(Utf8.class, Flushed.class, conf);
  
  Query<Utf8,Flushed> query = flushedTable.newQuery();
  Result<Utf8,Flushed> result = flushedTable.execute(query);
  
  ArrayList<String> flushedEntries = new ArrayList<>();
  while (result.next()) {
    flushedEntries.add(result.getKey() + ":" + result.get().getCount());
  }
  
  conf.setStrings("org.apache.gora.goraci.verify.flushed", flushedEntries.toArray(new String[] {}));
  
  flushedTable.close();
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:16,代码来源:Verify.java

示例14: printResult

import org.apache.gora.query.Result; //导入方法依赖的package包/类
private void printResult(Result<Long, Pageview> result) throws Exception {
  
  while(result.next()) { //advances the Result object and breaks if at end
    long resultKey = result.getKey(); //obtain current key
    Pageview resultPageview = result.get(); //obtain current value object
    
    log.info("{} :", resultKey);
    printPageview(resultPageview);
  }
  
  log.info("Number of pageviews from the query: {}", result.getOffset());
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:13,代码来源:LogManager.java

示例15: deleteByQuery

import org.apache.gora.query.Result; //导入方法依赖的package包/类
@Override
public long deleteByQuery(Query<K, T> query) {
try{
  long deletedRows = 0;
    Result<K,T> result = query.execute();

    while(result.next()) {
      if(delete(result.getKey()))
        deletedRows++;
    }
    return deletedRows;
  } catch (Exception e) {
    return 0;
  }
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:16,代码来源:MemStore.java


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