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

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

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

ConcurrentHashMap.mappingCount介绍

暂无

代码示例

代码示例来源:origin: ben-manes/caffeine

@Override
public long estimatedSize() {
 return data.mappingCount();
}

代码示例来源:origin: ben-manes/caffeine

@Override
public long estimatedSize() {
 return data.mappingCount();
}

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

public long mappingCount() {
  return backingMap.mappingCount();
}

代码示例来源:origin: ben-manes/caffeine

private void status() {
 int drainStatus;
 int pendingWrites;
 local.evictionLock.lock();
 try {
  pendingWrites = local.writeBuffer().size();
  drainStatus = local.drainStatus();
 } finally {
  local.evictionLock.unlock();
 }
 LocalTime elapsedTime = LocalTime.ofSecondOfDay(stopwatch.elapsed(TimeUnit.SECONDS));
 System.out.printf("---------- %s ----------%n", elapsedTime);
 System.out.printf("Pending reads: %,d; writes: %,d%n", local.readBuffer.size(), pendingWrites);
 System.out.printf("Drain status = %s (%s)%n", STATUS[drainStatus], drainStatus);
 System.out.printf("Evictions = %,d%n", cache.stats().evictionCount());
 System.out.printf("Size = %,d (max: %,d)%n", local.data.mappingCount(), operation.maxEntries);
 System.out.printf("Lock = [%s%n", StringUtils.substringAfter(
   local.evictionLock.toString(), "["));
 System.out.printf("Pending tasks = %,d%n",
   ForkJoinPool.commonPool().getQueuedSubmissionCount());
 long maxMemory = Runtime.getRuntime().maxMemory();
 long freeMemory = Runtime.getRuntime().freeMemory();
 long allocatedMemory = Runtime.getRuntime().totalMemory();
 System.out.printf("Max Memory = %,d bytes%n", maxMemory);
 System.out.printf("Free Memory = %,d bytes%n", freeMemory);
 System.out.printf("Allocated Memory = %,d bytes%n", allocatedMemory);
 System.out.println();
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

@Override
public long estimatedSize() {
 return data.mappingCount();
}

代码示例来源:origin: com.github.ben-manes.caffeine/caffeine

@Override
public long estimatedSize() {
 return data.mappingCount();
}

代码示例来源:origin: biezhi/learn-java8

private static void testForEach() {
    ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
    map.putIfAbsent("foo", "bar");
    map.putIfAbsent("han", "solo");
    map.putIfAbsent("r2", "d2");
    map.putIfAbsent("c3", "p0");

    map.forEach(1, (key, value) -> System.out.printf("key: %s; value: %s; thread: %s\n", key, value, Thread.currentThread().getName()));
//        map.forEach(5, (key, value) -> System.out.printf("key: %s; value: %s; thread: %s\n", key, value, Thread.currentThread().getName()));

    System.out.println(map.mappingCount());
  }

代码示例来源:origin: org.wildfly/wildfly-naming-client

public long mappingCount() {
  return backingMap.mappingCount();
}

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

public long mappingCount() {
  return backingMap.mappingCount();
}

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

private static void testForEach() {
  ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
  map.putIfAbsent("foo", "bar");
  map.putIfAbsent("han", "solo");
  map.putIfAbsent("r2", "d2");
  map.putIfAbsent("c3", "p0");
  map.forEach(1, (key, value) -> System.out
    .printf("key: %s; value: %s; thread: %s\n", key, value, Thread.currentThread().getName()));
  //        map.forEach(5, (key, value) -> System.out.printf("key: %s; value: %s; thread: %s\n", key, value,
  // Thread.currentThread().getName()));
  System.out.println(map.mappingCount());
}

相关文章