Example usage for io.netty.buffer PooledByteBufAllocator numThreadLocalCaches

List of usage examples for io.netty.buffer PooledByteBufAllocator numThreadLocalCaches

Introduction

In this page you can find the example usage for io.netty.buffer PooledByteBufAllocator numThreadLocalCaches.

Prototype

@Deprecated
public int numThreadLocalCaches() 

Source Link

Document

Return the number of thread local caches used by this PooledByteBufAllocator .

Usage

From source file:com.yahoo.pulsar.broker.stats.AllocatorStatsGenerator.java

License:Apache License

public static AllocatorStats generate(String allocatorName) {
    PooledByteBufAllocator allocator = null;
    if ("default".equals(allocatorName)) {
        allocator = PooledByteBufAllocator.DEFAULT;
    } else if ("ml-cache".equals(allocatorName)) {
        allocator = EntryCacheImpl.allocator;
    } else {// w  w w. ja va2s  .  c  o  m
        throw new IllegalArgumentException("Invalid allocator name : " + allocatorName);
    }

    AllocatorStats stats = new AllocatorStats();
    stats.directArenas = allocator.directArenas().stream().map(x -> newPoolArenaStats(x))
            .collect(Collectors.toList());
    stats.heapArenas = allocator.heapArenas().stream().map(x -> newPoolArenaStats(x))
            .collect(Collectors.toList());

    stats.numDirectArenas = allocator.numDirectArenas();
    stats.numHeapArenas = allocator.numHeapArenas();
    stats.numThreadLocalCaches = allocator.numThreadLocalCaches();
    stats.normalCacheSize = allocator.normalCacheSize();
    stats.smallCacheSize = allocator.smallCacheSize();
    stats.tinyCacheSize = allocator.tinyCacheSize();
    return stats;
}