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

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

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

BlockingQueue.forEach介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

public void destroy() {
  deflater_pool.forEach(Deflater::end);
  inflater_pool.forEach(Inflater::end);
}

代码示例来源:origin: apache/pulsar

if (cnx == null) {
  final AtomicInteger releaseCount = new AtomicInteger();
  pendingMessages.forEach(op -> {
    releaseCount.addAndGet(op.numMessagesInBatch);
    try {

代码示例来源:origin: apache/pulsar

@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  super.channelInactive(ctx);
  log.info("{} Disconnected", ctx.channel());
  if (!connectionFuture.isDone()) {
    connectionFuture.completeExceptionally(new PulsarClientException("Connection already closed"));
  }
  PulsarClientException e = new PulsarClientException(
      "Disconnected from server at " + ctx.channel().remoteAddress());
  // Fail out all the pending ops
  pendingRequests.forEach((key, future) -> future.completeExceptionally(e));
  pendingLookupRequests.forEach((key, future) -> future.completeExceptionally(e));
  waitingLookupRequests.forEach(pair -> pair.getRight().getRight().completeExceptionally(e));
  pendingGetLastMessageIdRequests.forEach((key, future) -> future.completeExceptionally(e));
  pendingGetTopicsRequests.forEach((key, future) -> future.completeExceptionally(e));
  pendingGetSchemaRequests.forEach((key, future) -> future.completeExceptionally(e));
  // Notify all attached producers/consumers so they have a chance to reconnect
  producers.forEach((id, producer) -> producer.connectionClosed(this));
  consumers.forEach((id, consumer) -> consumer.connectionClosed(this));
  pendingRequests.clear();
  pendingLookupRequests.clear();
  waitingLookupRequests.clear();
  pendingGetLastMessageIdRequests.clear();
  pendingGetTopicsRequests.clear();
  producers.clear();
  consumers.clear();
  timeoutTask.cancel(true);
}

代码示例来源:origin: apache/pulsar

PulsarClientException ex = new PulsarClientException.AlreadyClosedException(
    "Producer was already closed");
pendingMessages.forEach(msg -> {
  msg.callback.sendComplete(ex);
  msg.cmd.release();
  log.info("[{}] [{}] Closed Producer", topic, producerName);
  setState(State.Closed);
  pendingMessages.forEach(msg -> {
    msg.cmd.release();
    msg.recycle();

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void destroy() {
  deflater_pool.forEach(Deflater::end);
  inflater_pool.forEach(Inflater::end);
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.app/inception-scheduling

public List<Task> getScheduledTasks()
{
  List<Task> result = new ArrayList<>();
  executor.getQueue().forEach(r -> result.add((Task) r));
  return result;
}

代码示例来源:origin: inception-project/inception

public List<Task> getScheduledTasks()
{
  List<Task> result = new ArrayList<>();
  executor.getQueue().forEach(r -> result.add((Task) r));
  return result;
}

代码示例来源:origin: net.openhft/chronicle-engine

queue.forEach(action::accept);

代码示例来源:origin: mauricioaniche/repodriller

/**
 * Conclude the visit to the current repo.
 * Calls {@link CommitVisitor#finalize} on each CommitVisitor in my collection.
 */
void endRepoVisit() {
  /* finalize() the visitors with the repo. */
  for (CVPM cvpm : visitors) {
    try {
      log.info("-> Finalizing visitor " + cvpm.cv.name());
      cvpm.cv.finalize(currentRepo, cvpm.pm);
    } catch (Exception e) {
      log.error("Error in " + currentRepo.getPath() +
          "when finalizing " + cvpm.cv.name() + ", error=" + e.getMessage(), e);
    }
  }
  /* Clean the clonePool. */
  assert(clonePool.remainingCapacity() == 0); // No leaked clones.
  clonePool.forEach(clone -> {
    clone.repo.getScm().delete(); // Safe to call more than once on the same SCM, if !visitorsChangeRepoState.
  });
  clonePool.clear();
  /* No current repo. */
  currentRepo = null;
}

代码示例来源:origin: org.apache.pulsar/pulsar-client-original

if (cnx == null) {
  final AtomicInteger releaseCount = new AtomicInteger();
  pendingMessages.forEach(op -> {
    releaseCount.addAndGet(op.numMessagesInBatch);
    try {

代码示例来源:origin: com.yahoo.pulsar/pulsar-client

if (cnx == null) {
  final AtomicInteger releaseCount = new AtomicInteger();
  pendingMessages.forEach(op -> {
    releaseCount.addAndGet(op.numMessagesInBatch);
    try {

代码示例来源:origin: org.apache.pulsar/pulsar-client-original

@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  super.channelInactive(ctx);
  log.info("{} Disconnected", ctx.channel());
  if (!connectionFuture.isDone()) {
    connectionFuture.completeExceptionally(new PulsarClientException("Connection already closed"));
  }
  PulsarClientException e = new PulsarClientException(
      "Disconnected from server at " + ctx.channel().remoteAddress());
  // Fail out all the pending ops
  pendingRequests.forEach((key, future) -> future.completeExceptionally(e));
  pendingLookupRequests.forEach((key, future) -> future.completeExceptionally(e));
  waitingLookupRequests.forEach(pair -> pair.getRight().getRight().completeExceptionally(e));
  pendingGetLastMessageIdRequests.forEach((key, future) -> future.completeExceptionally(e));
  pendingGetTopicsRequests.forEach((key, future) -> future.completeExceptionally(e));
  pendingGetSchemaRequests.forEach((key, future) -> future.completeExceptionally(e));
  // Notify all attached producers/consumers so they have a chance to reconnect
  producers.forEach((id, producer) -> producer.connectionClosed(this));
  consumers.forEach((id, consumer) -> consumer.connectionClosed(this));
  pendingRequests.clear();
  pendingLookupRequests.clear();
  waitingLookupRequests.clear();
  pendingGetLastMessageIdRequests.clear();
  pendingGetTopicsRequests.clear();
  producers.clear();
  consumers.clear();
}

代码示例来源:origin: com.yahoo.pulsar/pulsar-client

PulsarClientException ex = new PulsarClientException.AlreadyClosedException(
    "Producer was already closed");
pendingMessages.forEach(msg -> {
  msg.callback.sendComplete(ex);
  msg.cmd.release();
  log.info("[{}] [{}] Closed Producer", topic, producerName);
  setState(State.Closed);
  pendingMessages.forEach(msg -> {
    msg.cmd.release();
    msg.recycle();

代码示例来源:origin: org.apache.pulsar/pulsar-client-original

PulsarClientException ex = new PulsarClientException.AlreadyClosedException(
    "Producer was already closed");
pendingMessages.forEach(msg -> {
  msg.callback.sendComplete(ex);
  msg.cmd.release();
  log.info("[{}] [{}] Closed Producer", topic, producerName);
  setState(State.Closed);
  pendingMessages.forEach(msg -> {
    msg.cmd.release();
    msg.recycle();

相关文章