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


Java Iterators.cycle方法代码示例

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


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

示例1: ExternalSortBatch

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
public ExternalSortBatch(ExternalSort popConfig, FragmentContext context, RecordBatch incoming) throws OutOfMemoryException {
  super(popConfig, context, true);
  this.incoming = incoming;
  DrillConfig config = context.getConfig();
  Configuration conf = new Configuration();
  conf.set("fs.default.name", config.getString(ExecConstants.EXTERNAL_SORT_SPILL_FILESYSTEM));
  try {
    this.fs = FileSystem.get(conf);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  SPILL_BATCH_GROUP_SIZE = config.getInt(ExecConstants.EXTERNAL_SORT_SPILL_GROUP_SIZE);
  SPILL_THRESHOLD = config.getInt(ExecConstants.EXTERNAL_SORT_SPILL_THRESHOLD);
  dirs = Iterators.cycle(config.getStringList(ExecConstants.EXTERNAL_SORT_SPILL_DIRS));
  copierAllocator = oContext.getAllocator().getChildAllocator(
      context, PriorityQueueCopier.INITIAL_ALLOCATION, PriorityQueueCopier.MAX_ALLOCATION, true);
  FragmentHandle handle = context.getHandle();
  fileName = String.format("%s/major_fragment_%s/minor_fragment_%s/operator_%s", QueryIdHelper.getQueryId(handle.getQueryId()),
      handle.getMajorFragmentId(), handle.getMinorFragmentId(), popConfig.getOperatorId());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:21,代码来源:ExternalSortBatch.java

示例2: manyFiles

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Test
public void manyFiles() throws Exception {
  List<CompleteFileWork> chunks = generateChunks(1000);

  Iterator<DrillbitEndpoint> incomingEndpointsIterator = Iterators.cycle(endpoints);

  List<DrillbitEndpoint> incomingEndpoints = Lists.newArrayList();

  final int width = 28 * 30;
  for (int i = 0; i < width; i++) {
    incomingEndpoints.add(incomingEndpointsIterator.next());
  }

  ListMultimap<Integer, CompleteFileWork> mappings = AssignmentCreator.getMappings(incomingEndpoints, chunks, null);
  System.out.println(mappings.keySet().size());
  for (int i = 0; i < width; i++) {
    Assert.assertTrue("no mapping for entry " + i, mappings.get(i) != null && mappings.get(i).size() > 0);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:TestAssignment.java

示例3: recalculateOrdering

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private void recalculateOrdering() {
    // clear ordering
    order.clear();

    // Create new ordering, probably a better way to do this...
    for (Map.Entry<VirtualSpoutIdentifier, Boolean> entry: allIds.entrySet()) {
        // If throttled
        if (entry.getValue()) {
            order.add(entry.getKey());
        } else {
            // Add entries at ratio
            for (int x = 0; x < ratio; x++) {
                order.add(entry.getKey());
            }
        }
    }

    // create new iterator that cycles endlessly
    consumerIdIterator = Iterators.cycle(order);
}
 
开发者ID:salesforce,项目名称:storm-dynamic-spout,代码行数:21,代码来源:RatioMessageBuffer.java

示例4: manyFiles

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Test
public void manyFiles() throws Exception {
  List<CompleteWork> chunks = generateChunks(1000);

  Iterator<NodeEndpoint> incomingEndpointsIterator = Iterators.cycle(endpoints);

  List<NodeEndpoint> incomingEndpoints = Lists.newArrayList();

  final int width = 28 * 30;
  for (int i = 0; i < width; i++) {
    incomingEndpoints.add(incomingEndpointsIterator.next());
  }

  ListMultimap<Integer, CompleteWork> mappings = AssignmentCreator.getMappings(incomingEndpoints, chunks);
  System.out.println(mappings.keySet().size());
  for (int i = 0; i < width; i++) {
    Assert.assertTrue("no mapping for entry " + i, mappings.get(i) != null && mappings.get(i).size() > 0);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:TestAssignment.java

示例5: getIterator

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private Iterator<Martini> getIterator(Mixologist mixologist) {
	String spelFilter = super.getPropertyAsString(ARGUMENT_SPEL_FILTER).trim();
	Collection<Martini> martiniCollection =
		spelFilter.isEmpty() ? mixologist.getMartinis() : mixologist.getMartinis(spelFilter);
	List<Martini> martinis = new ArrayList<>(martiniCollection);

	boolean shuffled = super.getPropertyAsBoolean(ARGUMENT_SHUFFLED_ITERATION);
	if (shuffled) {
		SecureRandom random = new SecureRandom();
		Collections.shuffle(martinis, random);
	}

	boolean cyclic = super.getPropertyAsBoolean(ARGUMENT_CYCLIC_ITERATOR);
	return cyclic ? Iterators.cycle(martinis) : Iterators.consumingIterator(martinis.iterator());
}
 
开发者ID:qas-guru,项目名称:martini-jmeter-extension,代码行数:16,代码来源:MartiniPreProcessor.java

示例6: TrackerClientProvider

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
public TrackerClientProvider(final TorrentWithStats torrent, final ConnectionHandler connectionHandler, final BitTorrentClient bitTorrentClient) {
    this.torrent = torrent;
    this.connectionHandler = connectionHandler;
    this.bitTorrentClient = bitTorrentClient;
    final Set<URI> addresses = torrent.getTorrent().getAnnounceList().stream()
            .unordered()
            .flatMap(Collection::stream)
            .collect(Collectors.toSet());

    this.addressIterator = Iterators.cycle(addresses);
    this.addressesCount = addresses.size();
}
 
开发者ID:anthonyraymond,项目名称:joal,代码行数:13,代码来源:TrackerClientProvider.java

示例7: reset

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private void reset() {
  allFilesCyclic = Iterators.cycle(files.values());
  restart();
}
 
开发者ID:inferjay,项目名称:r8,代码行数:5,代码来源:VirtualFile.java


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