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


Java Flushed类代码示例

本文整理汇总了Java中org.apache.gora.goraci.generated.Flushed的典型用法代码示例。如果您正苦于以下问题:Java Flushed类的具体用法?Java Flushed怎么用?Java Flushed使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Flushed类属于org.apache.gora.goraci.generated包,在下文中一共展示了Flushed类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFlushed

import org.apache.gora.goraci.generated.Flushed; //导入依赖的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

示例2: map

import org.apache.gora.goraci.generated.Flushed; //导入依赖的package包/类
@Override
protected void map(LongWritable key, NullWritable value, Context output) throws IOException {
  long num = key.get();
  LOG.info("num {}", num);
  
  Utf8 id = new Utf8(UUID.randomUUID().toString());
  
  Configuration conf = new Configuration();
  DataStore<Long,CINode> store = DataStoreFactory.getDataStore(Long.class, CINode.class, conf);
  DataStore<Utf8,Flushed> flushedTable = null;
  
  if (concurrent) {
    flushedTable = DataStoreFactory.getDataStore(Utf8.class, Flushed.class, conf);
    flushedTable.createSchema();
  }
  
  store.createSchema();
  
  Random rand = new Random();
  
  long[] first = null;
  long[] prev = null;
  long[] current = new long[WIDTH];
  
  long count = 0;
  while (count < num) {
    for (int i = 0; i < current.length; i++)
      current[i] = Math.abs(rand.nextLong());
    
    persist(output, store, count, prev, current, id);
    
    if (first == null)
      first = current;
    prev = current;
    current = new long[WIDTH];
    
    count += current.length;
    output.setStatus("Count " + count);
    
    if (count % WRAP == 0) {
      // this block of code turns the 1 million linked list of length 25 into one giant circular linked list of 25 million
      
      circularLeftShift(first);
      
      updatePrev(store, first, prev);
      
      if (concurrent) {
      // keep track of whats flushed in another table, verify can use this info to run concurrently
        Flushed flushed = flushedTable.newPersistent();
        flushed.setCount(count);
        flushedTable.put(id, flushed);
        flushedTable.flush();
      }

      first = null;
      prev = null;
    }
    
  }
  
  store.close();
  if (concurrent)
    flushedTable.close();
  
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:66,代码来源:Generator.java


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