@Override public long estimatedSize() { return data.mappingCount(); }
@Override public long estimatedSize() { return data.mappingCount(); }
public long mappingCount() { return backingMap.mappingCount(); }
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(); }
@Override public long estimatedSize() { return data.mappingCount(); }
@Override public long estimatedSize() { return data.mappingCount(); }
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()); }
public long mappingCount() { return backingMap.mappingCount(); }
public long mappingCount() { return backingMap.mappingCount(); }
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()); }