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

x33g5p2x  于2022-01-17 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(322)

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

ConcurrentHashMap.forEachValue介绍

暂无

代码示例

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

public void keepalive() {
    connections.forEachValue(25, socket -> {
      try {
        if (socket.isOpen()) {
          socket.ping();
        }
      } catch (IOException e) {
        if ("Connection output is closed".equals(e.getMessage())) {
          deregister(socket);
          socket.close();
        }
        LOGGER.error("Failed to ping socket %s", socket.key(), e);
      }
    });
  }
}

代码示例来源:origin: Alluxio/alluxio

@VisibleForTesting
void verifyIndices() {
 mMap.forEachValue(1, entry -> {
  if (entry.mValue == null) {
   if (!mUnflushedDeletes.get(entry.mKey.getId()).contains(entry.mKey.getName())) {

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

this.procedures.forEachValue(1 /*Single-threaded*/,

代码示例来源:origin: com.qwazr/qwazr-search

@Override
public void close() {
  indexMap.forEachValue(1, IOUtils::closeQuietly);
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-sail-nativerdf

public void flush() {
  cache.forEachValue(Long.MAX_VALUE, writeNode);
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-sail-nativerdf

public void flush() {
  cache.forEachValue(Long.MAX_VALUE, writeNode);
}

代码示例来源:origin: org.microbean/microbean-kubernetes-controller-cdi

private void destroy() {
 this.active = false; // prevent new 
 this.instances.forEachValue(Long.MAX_VALUE, v -> v.destroy());
 this.instances.clear();
}

代码示例来源:origin: dunwu/javacore

public static void main(String[] args) {
    ConcurrentHashMap<Integer, UUID> concurrentHashMap = new ConcurrentHashMap<>();

    for (int i = 0; i < 100; i++) {
      concurrentHashMap.put(i, UUID.randomUUID());
    }

    int threshold = 1;

    concurrentHashMap.forEachValue(threshold, System.out::println);

    concurrentHashMap.forEach((id, uuid) -> {
      if (id % 10 == 0) {
        System.out.println(String.format("%s: %s", id, uuid));
      }
    });

    UUID searchResult = concurrentHashMap.search(threshold, (id, uuid) -> {
      if (String.valueOf(uuid).startsWith(String.valueOf(id))) {
        return uuid;
      }
      return null;
    });

    System.out.println(searchResult);
  }
}

代码示例来源:origin: org.apache.hbase/hbase-procedure

this.procedures.forEachValue(1 /*Single-threaded*/,

相关文章