kirklund commented on code in PR #7635:
URL: https://github.com/apache/geode/pull/7635#discussion_r865410911
##########
geode-core/src/main/java/org/apache/geode/internal/stats50/BufferPoolStats.java:
##########
@@ -40,47 +39,62 @@ public class BufferPoolStats {
private final int bufferPoolTotalCapacityId;
private final int bufferPoolMemoryUsedId;
- private final Map<BufferPoolMXBean, Statistics> bufferPoolStatistics =
- new IdentityHashMap<>();
+ private final List<BufferPoolMXBeanStatistics> bufferPoolStatistics;
- BufferPoolStats(final @NotNull StatisticsTypeFactory typeFactory) {
+ BufferPoolStats(final @NotNull StatisticsFactory statisticsFactory, final
long id) {
+ this(statisticsFactory, id, getPlatformMXBeans(BufferPoolMXBean.class));
+ }
+
+ BufferPoolStats(final @NotNull StatisticsFactory statisticsFactory, final
long id,
+ final List<BufferPoolMXBean> platformMXBeans) {
bufferPoolType =
- typeFactory.createType("PlatformBufferPoolStats", "Java platform
buffer pools.",
+ statisticsFactory.createType("PlatformBufferPoolStats", "Java platform
buffer pools.",
new StatisticDescriptor[] {
- typeFactory.createLongGauge("count",
+ statisticsFactory.createLongGauge("count",
"An estimate of the number of buffers in this pool.",
"buffers"),
- typeFactory.createLongGauge("totalCapacity",
+ statisticsFactory.createLongGauge("totalCapacity",
"An estimate of the total capacity of the buffers in this
pool in bytes.",
"bytes"),
- typeFactory.createLongGauge("memoryUsed",
+ statisticsFactory.createLongGauge("memoryUsed",
"An estimate of the memory that the Java virtual machine
is using for this buffer pool in bytes, or -1L if an estimate of the memory
usage is not available.",
"bytes")});
bufferPoolCountId = bufferPoolType.nameToId("count");
bufferPoolTotalCapacityId = bufferPoolType.nameToId("totalCapacity");
bufferPoolMemoryUsedId = bufferPoolType.nameToId("memoryUsed");
- }
-
- void init(final @NotNull StatisticsFactory statisticsFactory, final long id)
{
- init(statisticsFactory, id, getPlatformMXBeans(BufferPoolMXBean.class));
- }
- void init(final StatisticsFactory statisticsFactory, final long id,
- final List<BufferPoolMXBean> platformMXBeans) {
- platformMXBeans.forEach(
- pool -> bufferPoolStatistics.computeIfAbsent(pool,
- k -> statisticsFactory.createStatistics(bufferPoolType,
k.getName() + " buffer pool",
- id)));
+ ArrayList<BufferPoolMXBeanStatistics> statList = new
ArrayList<>(platformMXBeans.size());
Review Comment:
Can this be declared as `List<BufferPoolMXBeanStatistics>`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]