java.util.concurrent.BlockingQueue.parallelStream()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中java.util.concurrent.BlockingQueue.parallelStream()方法的一些代码示例,展示了BlockingQueue.parallelStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockingQueue.parallelStream()方法的具体详情如下:
包路径:java.util.concurrent.BlockingQueue
类名称:BlockingQueue
方法名:parallelStream

BlockingQueue.parallelStream介绍

暂无

代码示例

代码示例来源:origin: seleniumkit/selenograph

@GET
@Path("/perform")
public Response resetDelayedQueues(@QueryParam("action") String action, @QueryParam("object") String object) {
  switch (action) {
    case "clearQueue":
      getSedaQueues().get(object).getQueue().clear();
      break;
    case "printQueue":
      return ok()
          .header("Content-Type", "application/json")
          .entity(getSedaQueues().get(object).getQueue().parallelStream().collect(toList()))
          .build();
  }
  return ok("ok").build();
}

代码示例来源:origin: jenkinsci/mesos-plugin

/**
 * This method removes an offer from the queue based on its OfferID.
 */
public void remove(Protos.OfferID offerID) {
  Collection<Protos.Offer> offers = queue.parallelStream()
      .filter(offer -> offer.getId().equals(offerID))
      .collect(Collectors.toList());
  boolean removed = queue.removeAll(offers);
  if (!removed) {
    logger.warning(
        String.format(
            "Attempted to remove offer: '%s' but it was not present in the queue.",
            offerID.getValue()));
  } else {
    logger.info(String.format("Removed offer: %s", offerID.getValue()));
    Metrics.metricRegistry().meter("mesos.offer.queue.removed").mark();
  }
}

代码示例来源:origin: mesosphere/dcos-commons

/**
 * This method removes an offer from the queue based on its OfferID.
 */
public void remove(Protos.OfferID offerID) {
 Collection<Protos.Offer> offers = queue.parallelStream()
   .filter(offer -> offer.getId().equals(offerID))
   .collect(Collectors.toList());
 boolean removed = queue.removeAll(offers);
 if (!removed) {
  logger.warn(
    "Attempted to remove offer: '{}' but it was not present in the queue.",
    offerID.getValue());
 } else {
  logger.info("Removed offer: {}", offerID.getValue());
 }
}

相关文章