JvmStats to implement Writeable rather than Streamable

also removed null checks in toXContent for subobjects that cannot be null and added @Nullable annotation for memory pools
This commit is contained in:
javanna 2016-09-02 15:50:51 +02:00 committed by Luca Cavanna
parent 931a164b1f
commit 102dac2cd9
2 changed files with 221 additions and 299 deletions

View File

@ -218,7 +218,7 @@ public class NodeStats extends BaseNodeResponse implements ToXContent {
process = new ProcessStats(in);
}
if (in.readBoolean()) {
jvm = JvmStats.readJvmStats(in);
jvm = new JvmStats(in);
}
if (in.readBoolean()) {
threadPool = ThreadPoolStats.readThreadPoolStats(in);

View File

@ -19,9 +19,10 @@
package org.elasticsearch.monitor.jvm;
import org.elasticsearch.common.inject.internal.Nullable;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
@ -39,14 +40,12 @@ import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
*
*/
public class JvmStats implements Streamable, ToXContent {
public class JvmStats implements Writeable, ToXContent {
private static final RuntimeMXBean runtimeMXBean;
private static final MemoryMXBean memoryMXBean;
@ -61,21 +60,17 @@ public class JvmStats implements Streamable, ToXContent {
}
public static JvmStats jvmStats() {
JvmStats stats = new JvmStats(System.currentTimeMillis(), runtimeMXBean.getUptime());
stats.mem = new Mem();
MemoryUsage memUsage = memoryMXBean.getHeapMemoryUsage();
stats.mem.heapUsed = memUsage.getUsed() < 0 ? 0 : memUsage.getUsed();
stats.mem.heapCommitted = memUsage.getCommitted() < 0 ? 0 : memUsage.getCommitted();
stats.mem.heapMax = memUsage.getMax() < 0 ? 0 : memUsage.getMax();
long heapUsed = memUsage.getUsed() < 0 ? 0 : memUsage.getUsed();
long heapCommitted = memUsage.getCommitted() < 0 ? 0 : memUsage.getCommitted();
long heapMax = memUsage.getMax() < 0 ? 0 : memUsage.getMax();
memUsage = memoryMXBean.getNonHeapMemoryUsage();
stats.mem.nonHeapUsed = memUsage.getUsed() < 0 ? 0 : memUsage.getUsed();
stats.mem.nonHeapCommitted = memUsage.getCommitted() < 0 ? 0 : memUsage.getCommitted();
long nonHeapUsed = memUsage.getUsed() < 0 ? 0 : memUsage.getUsed();
long nonHeapCommitted = memUsage.getCommitted() < 0 ? 0 : memUsage.getCommitted();
List<MemoryPoolMXBean> memoryPoolMXBeans = ManagementFactory.getMemoryPoolMXBeans();
List<MemoryPool> pools = new ArrayList<>();
for (int i = 0; i < memoryPoolMXBeans.size(); i++) {
for (MemoryPoolMXBean memoryPoolMXBean : memoryPoolMXBeans) {
try {
MemoryPoolMXBean memoryPoolMXBean = memoryPoolMXBeans.get(i);
MemoryUsage usage = memoryPoolMXBean.getUsage();
MemoryUsage peakUsage = memoryPoolMXBean.getPeakUsage();
String name = GcNames.getByMemoryPoolName(memoryPoolMXBean.getName(), null);
@ -94,55 +89,84 @@ public class JvmStats implements Streamable, ToXContent {
* we just omit the pool in that case!*/
}
}
stats.mem.pools = pools.toArray(new MemoryPool[pools.size()]);
stats.threads = new Threads();
stats.threads.count = threadMXBean.getThreadCount();
stats.threads.peakCount = threadMXBean.getPeakThreadCount();
MemoryPool[] memoryPools = pools.toArray(new MemoryPool[pools.size()]);
Mem mem = new Mem(heapCommitted, heapUsed, heapMax, nonHeapCommitted, nonHeapUsed, memoryPools);
Threads threads = new Threads(threadMXBean.getThreadCount(), threadMXBean.getPeakThreadCount());
List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
stats.gc = new GarbageCollectors();
stats.gc.collectors = new GarbageCollector[gcMxBeans.size()];
for (int i = 0; i < stats.gc.collectors.length; i++) {
GarbageCollector[] collectors = new GarbageCollector[gcMxBeans.size()];
for (int i = 0; i < collectors.length; i++) {
GarbageCollectorMXBean gcMxBean = gcMxBeans.get(i);
stats.gc.collectors[i] = new GarbageCollector();
stats.gc.collectors[i].name = GcNames.getByGcName(gcMxBean.getName(), gcMxBean.getName());
stats.gc.collectors[i].collectionCount = gcMxBean.getCollectionCount();
stats.gc.collectors[i].collectionTime = gcMxBean.getCollectionTime();
collectors[i] = new GarbageCollector(GcNames.getByGcName(gcMxBean.getName(), gcMxBean.getName()),
gcMxBean.getCollectionCount(), gcMxBean.getCollectionTime());
}
GarbageCollectors garbageCollectors = new GarbageCollectors(collectors);
List<BufferPool> bufferPoolsList = null;
try {
List<BufferPoolMXBean> bufferPools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
stats.bufferPools = new ArrayList<>(bufferPools.size());
bufferPoolsList = new ArrayList<>(bufferPools.size());
for (BufferPoolMXBean bufferPool : bufferPools) {
stats.bufferPools.add(new BufferPool(bufferPool.getName(), bufferPool.getCount(), bufferPool.getTotalCapacity(), bufferPool.getMemoryUsed()));
bufferPoolsList.add(new BufferPool(bufferPool.getName(), bufferPool.getCount(),
bufferPool.getTotalCapacity(), bufferPool.getMemoryUsed()));
}
} catch (Exception e) {
// buffer pools are not available
}
stats.classes = new Classes();
stats.classes.loadedClassCount = classLoadingMXBean.getLoadedClassCount();
stats.classes.totalLoadedClassCount = classLoadingMXBean.getTotalLoadedClassCount();
stats.classes.unloadedClassCount = classLoadingMXBean.getUnloadedClassCount();
Classes classes = new Classes(classLoadingMXBean.getLoadedClassCount(), classLoadingMXBean.getTotalLoadedClassCount(),
classLoadingMXBean.getUnloadedClassCount());
return stats;
return new JvmStats(System.currentTimeMillis(), runtimeMXBean.getUptime(), mem, threads,
garbageCollectors, bufferPoolsList, classes);
}
long timestamp = -1;
long uptime;
Mem mem;
Threads threads;
GarbageCollectors gc;
List<BufferPool> bufferPools;
Classes classes;
private final long timestamp;
private final long uptime;
private final Mem mem;
private final Threads threads;
private final GarbageCollectors gc;
private final List<BufferPool> bufferPools;
private final Classes classes;
private JvmStats() {
}
public JvmStats(long timestamp, long uptime) {
public JvmStats(long timestamp, long uptime, Mem mem, Threads threads, GarbageCollectors gc,
@Nullable List<BufferPool> bufferPools, Classes classes) {
this.timestamp = timestamp;
this.uptime = uptime;
this.mem = mem;
this.threads = threads;
this.gc = gc;
this.bufferPools = bufferPools;
this.classes = classes;
}
public JvmStats(StreamInput in) throws IOException {
timestamp = in.readVLong();
uptime = in.readVLong();
mem = new Mem(in);
threads = new Threads(in);
gc = new GarbageCollectors(in);
if (in.readBoolean()) {
bufferPools = in.readList(BufferPool::new);
} else {
bufferPools = Collections.emptyList();
}
classes = new Classes(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(timestamp);
out.writeVLong(uptime);
mem.writeTo(out);
threads.writeTo(out);
gc.writeTo(out);
if (bufferPools == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeList(bufferPools);
}
classes.writeTo(out);
}
public long getTimestamp() {
@ -178,53 +202,50 @@ public class JvmStats implements Streamable, ToXContent {
builder.startObject(Fields.JVM);
builder.field(Fields.TIMESTAMP, timestamp);
builder.timeValueField(Fields.UPTIME_IN_MILLIS, Fields.UPTIME, uptime);
if (mem != null) {
builder.startObject(Fields.MEM);
builder.byteSizeField(Fields.HEAP_USED_IN_BYTES, Fields.HEAP_USED, mem.heapUsed);
if (mem.getHeapUsedPercent() >= 0) {
builder.field(Fields.HEAP_USED_PERCENT, mem.getHeapUsedPercent());
}
builder.byteSizeField(Fields.HEAP_COMMITTED_IN_BYTES, Fields.HEAP_COMMITTED, mem.heapCommitted);
builder.byteSizeField(Fields.HEAP_MAX_IN_BYTES, Fields.HEAP_MAX, mem.heapMax);
builder.byteSizeField(Fields.NON_HEAP_USED_IN_BYTES, Fields.NON_HEAP_USED, mem.nonHeapUsed);
builder.byteSizeField(Fields.NON_HEAP_COMMITTED_IN_BYTES, Fields.NON_HEAP_COMMITTED, mem.nonHeapCommitted);
builder.startObject(Fields.MEM);
builder.startObject(Fields.POOLS);
for (MemoryPool pool : mem) {
builder.startObject(pool.getName());
builder.byteSizeField(Fields.USED_IN_BYTES, Fields.USED, pool.used);
builder.byteSizeField(Fields.MAX_IN_BYTES, Fields.MAX, pool.max);
builder.byteSizeField(Fields.HEAP_USED_IN_BYTES, Fields.HEAP_USED, mem.heapUsed);
if (mem.getHeapUsedPercent() >= 0) {
builder.field(Fields.HEAP_USED_PERCENT, mem.getHeapUsedPercent());
}
builder.byteSizeField(Fields.HEAP_COMMITTED_IN_BYTES, Fields.HEAP_COMMITTED, mem.heapCommitted);
builder.byteSizeField(Fields.HEAP_MAX_IN_BYTES, Fields.HEAP_MAX, mem.heapMax);
builder.byteSizeField(Fields.NON_HEAP_USED_IN_BYTES, Fields.NON_HEAP_USED, mem.nonHeapUsed);
builder.byteSizeField(Fields.NON_HEAP_COMMITTED_IN_BYTES, Fields.NON_HEAP_COMMITTED, mem.nonHeapCommitted);
builder.byteSizeField(Fields.PEAK_USED_IN_BYTES, Fields.PEAK_USED, pool.peakUsed);
builder.byteSizeField(Fields.PEAK_MAX_IN_BYTES, Fields.PEAK_MAX, pool.peakMax);
builder.startObject(Fields.POOLS);
for (MemoryPool pool : mem) {
builder.startObject(pool.getName());
builder.byteSizeField(Fields.USED_IN_BYTES, Fields.USED, pool.used);
builder.byteSizeField(Fields.MAX_IN_BYTES, Fields.MAX, pool.max);
builder.endObject();
}
builder.endObject();
builder.byteSizeField(Fields.PEAK_USED_IN_BYTES, Fields.PEAK_USED, pool.peakUsed);
builder.byteSizeField(Fields.PEAK_MAX_IN_BYTES, Fields.PEAK_MAX, pool.peakMax);
builder.endObject();
}
if (threads != null) {
builder.startObject(Fields.THREADS);
builder.field(Fields.COUNT, threads.getCount());
builder.field(Fields.PEAK_COUNT, threads.getPeakCount());
builder.endObject();
builder.endObject();
builder.startObject(Fields.THREADS);
builder.field(Fields.COUNT, threads.getCount());
builder.field(Fields.PEAK_COUNT, threads.getPeakCount());
builder.endObject();
builder.startObject(Fields.GC);
builder.startObject(Fields.COLLECTORS);
for (GarbageCollector collector : gc) {
builder.startObject(collector.getName());
builder.field(Fields.COLLECTION_COUNT, collector.getCollectionCount());
builder.timeValueField(Fields.COLLECTION_TIME_IN_MILLIS, Fields.COLLECTION_TIME, collector.collectionTime);
builder.endObject();
}
if (gc != null) {
builder.startObject(Fields.GC);
builder.endObject();
builder.startObject(Fields.COLLECTORS);
for (GarbageCollector collector : gc) {
builder.startObject(collector.getName());
builder.field(Fields.COLLECTION_COUNT, collector.getCollectionCount());
builder.timeValueField(Fields.COLLECTION_TIME_IN_MILLIS, Fields.COLLECTION_TIME, collector.collectionTime);
builder.endObject();
}
builder.endObject();
builder.endObject();
}
builder.endObject();
if (bufferPools != null) {
builder.startObject(Fields.BUFFER_POOLS);
@ -238,13 +259,11 @@ public class JvmStats implements Streamable, ToXContent {
builder.endObject();
}
if (classes != null) {
builder.startObject(Fields.CLASSES);
builder.field(Fields.CURRENT_LOADED_COUNT, classes.getLoadedClassCount());
builder.field(Fields.TOTAL_LOADED_COUNT, classes.getTotalLoadedClassCount());
builder.field(Fields.TOTAL_UNLOADED_COUNT, classes.getUnloadedClassCount());
builder.endObject();
}
builder.startObject(Fields.CLASSES);
builder.field(Fields.CURRENT_LOADED_COUNT, classes.getLoadedClassCount());
builder.field(Fields.TOTAL_LOADED_COUNT, classes.getTotalLoadedClassCount());
builder.field(Fields.TOTAL_UNLOADED_COUNT, classes.getUnloadedClassCount());
builder.endObject();
builder.endObject();
return builder;
@ -291,7 +310,6 @@ public class JvmStats implements Streamable, ToXContent {
static final String COLLECTION_TIME_IN_MILLIS = "collection_time_in_millis";
static final String BUFFER_POOLS = "buffer_pools";
static final String NAME = "name";
static final String TOTAL_CAPACITY = "total_capacity";
static final String TOTAL_CAPACITY_IN_BYTES = "total_capacity_in_bytes";
@ -301,80 +319,21 @@ public class JvmStats implements Streamable, ToXContent {
static final String TOTAL_UNLOADED_COUNT = "total_unloaded_count";
}
public static class GarbageCollectors implements Writeable, Iterable<GarbageCollector> {
public static JvmStats readJvmStats(StreamInput in) throws IOException {
JvmStats jvmStats = new JvmStats();
jvmStats.readFrom(in);
return jvmStats;
}
private final GarbageCollector[] collectors;
@Override
public void readFrom(StreamInput in) throws IOException {
timestamp = in.readVLong();
uptime = in.readVLong();
mem = Mem.readMem(in);
threads = Threads.readThreads(in);
gc = GarbageCollectors.readGarbageCollectors(in);
if (in.readBoolean()) {
int size = in.readVInt();
bufferPools = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
BufferPool bufferPool = new BufferPool();
bufferPool.readFrom(in);
bufferPools.add(bufferPool);
}
}
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(timestamp);
out.writeVLong(uptime);
mem.writeTo(out);
threads.writeTo(out);
gc.writeTo(out);
if (bufferPools == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeVInt(bufferPools.size());
for (BufferPool bufferPool : bufferPools) {
bufferPool.writeTo(out);
}
}
}
public static class GarbageCollectors implements Streamable, Iterable<GarbageCollector> {
GarbageCollector[] collectors;
GarbageCollectors() {
public GarbageCollectors(GarbageCollector[] collectors) {
this.collectors = collectors;
}
public static GarbageCollectors readGarbageCollectors(StreamInput in) throws IOException {
GarbageCollectors collectors = new GarbageCollectors();
collectors.readFrom(in);
return collectors;
}
@Override
public void readFrom(StreamInput in) throws IOException {
collectors = new GarbageCollector[in.readVInt()];
for (int i = 0; i < collectors.length; i++) {
collectors[i] = GarbageCollector.readGarbageCollector(in);
}
public GarbageCollectors(StreamInput in) throws IOException {
collectors = in.readArray(GarbageCollector::new, GarbageCollector[]::new);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(collectors.length);
for (GarbageCollector gc : collectors) {
gc.writeTo(out);
}
out.writeArray(collectors);
}
public GarbageCollector[] getCollectors() {
@ -387,23 +346,19 @@ public class JvmStats implements Streamable, ToXContent {
}
}
public static class GarbageCollector implements Streamable {
public static class GarbageCollector implements Writeable {
String name;
long collectionCount;
long collectionTime;
private final String name;
private final long collectionCount;
private final long collectionTime;
GarbageCollector() {
public GarbageCollector(String name, long collectionCount, long collectionTime) {
this.name = name;
this.collectionCount = collectionCount;
this.collectionTime = collectionTime;
}
public static GarbageCollector readGarbageCollector(StreamInput in) throws IOException {
GarbageCollector gc = new GarbageCollector();
gc.readFrom(in);
return gc;
}
@Override
public void readFrom(StreamInput in) throws IOException {
public GarbageCollector(StreamInput in) throws IOException {
name = in.readString();
collectionCount = in.readVLong();
collectionTime = in.readVLong();
@ -429,30 +384,17 @@ public class JvmStats implements Streamable, ToXContent {
}
}
public static class Threads implements Streamable {
public static class Threads implements Writeable {
int count;
int peakCount;
private final int count;
private final int peakCount;
Threads() {
public Threads(int count, int peakCount) {
this.count = count;
this.peakCount = peakCount;
}
public int getCount() {
return count;
}
public int getPeakCount() {
return peakCount;
}
public static Threads readThreads(StreamInput in) throws IOException {
Threads threads = new Threads();
threads.readFrom(in);
return threads;
}
@Override
public void readFrom(StreamInput in) throws IOException {
public Threads(StreamInput in) throws IOException {
count = in.readVInt();
peakCount = in.readVInt();
}
@ -462,20 +404,23 @@ public class JvmStats implements Streamable, ToXContent {
out.writeVInt(count);
out.writeVInt(peakCount);
}
public int getCount() {
return count;
}
public int getPeakCount() {
return peakCount;
}
}
public static class MemoryPool implements Streamable {
public static class MemoryPool implements Writeable {
String name;
long used;
long max;
long peakUsed;
long peakMax;
MemoryPool() {
}
private final String name;
private final long used;
private final long max;
private final long peakUsed;
private final long peakMax;
public MemoryPool(String name, long used, long max, long peakUsed, long peakMax) {
this.name = name;
@ -485,10 +430,21 @@ public class JvmStats implements Streamable, ToXContent {
this.peakMax = peakMax;
}
public static MemoryPool readMemoryPool(StreamInput in) throws IOException {
MemoryPool pool = new MemoryPool();
pool.readFrom(in);
return pool;
public MemoryPool(StreamInput in) throws IOException {
name = in.readString();
used = in.readVLong();
max = in.readVLong();
peakUsed = in.readVLong();
peakMax = in.readVLong();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
out.writeVLong(used);
out.writeVLong(max);
out.writeVLong(peakUsed);
out.writeVLong(peakMax);
}
public String getName() {
@ -510,61 +466,33 @@ public class JvmStats implements Streamable, ToXContent {
public ByteSizeValue getPeakMax() {
return new ByteSizeValue(peakMax);
}
@Override
public void readFrom(StreamInput in) throws IOException {
name = in.readString();
used = in.readVLong();
max = in.readVLong();
peakUsed = in.readVLong();
peakMax = in.readVLong();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
out.writeVLong(used);
out.writeVLong(max);
out.writeVLong(peakUsed);
out.writeVLong(peakMax);
}
}
public static class Mem implements Streamable, Iterable<MemoryPool> {
public static class Mem implements Writeable, Iterable<MemoryPool> {
long heapCommitted;
long heapUsed;
long heapMax;
long nonHeapCommitted;
long nonHeapUsed;
private final long heapCommitted;
private final long heapUsed;
private final long heapMax;
private final long nonHeapCommitted;
private final long nonHeapUsed;
private final MemoryPool[] pools;
MemoryPool[] pools = new MemoryPool[0];
Mem() {
public Mem(long heapCommitted, long heapUsed, long heapMax, long nonHeapCommitted, long nonHeapUsed, MemoryPool[] pools) {
this.heapCommitted = heapCommitted;
this.heapUsed = heapUsed;
this.heapMax = heapMax;
this.nonHeapCommitted = nonHeapCommitted;
this.nonHeapUsed = nonHeapUsed;
this.pools = pools;
}
public static Mem readMem(StreamInput in) throws IOException {
Mem mem = new Mem();
mem.readFrom(in);
return mem;
}
@Override
public Iterator<MemoryPool> iterator() {
return Arrays.stream(pools).iterator();
}
@Override
public void readFrom(StreamInput in) throws IOException {
public Mem(StreamInput in) throws IOException {
heapCommitted = in.readVLong();
heapUsed = in.readVLong();
nonHeapCommitted = in.readVLong();
nonHeapUsed = in.readVLong();
heapMax = in.readVLong();
pools = new MemoryPool[in.readVInt()];
for (int i = 0; i < pools.length; i++) {
pools[i] = MemoryPool.readMemoryPool(in);
}
pools = in.readArray(MemoryPool::new, MemoryPool[]::new);
}
@Override
@ -574,10 +502,12 @@ public class JvmStats implements Streamable, ToXContent {
out.writeVLong(nonHeapCommitted);
out.writeVLong(nonHeapUsed);
out.writeVLong(heapMax);
out.writeVInt(pools.length);
for (MemoryPool pool : pools) {
pool.writeTo(out);
}
out.writeArray(pools);
}
@Override
public Iterator<MemoryPool> iterator() {
return Arrays.stream(pools).iterator();
}
public ByteSizeValue getHeapCommitted() {
@ -614,15 +544,12 @@ public class JvmStats implements Streamable, ToXContent {
}
}
public static class BufferPool implements Streamable {
public static class BufferPool implements Writeable {
String name;
long count;
long totalCapacity;
long used;
BufferPool() {
}
private final String name;
private final long count;
private final long totalCapacity;
private final long used;
public BufferPool(String name, long count, long totalCapacity, long used) {
this.name = name;
@ -631,6 +558,21 @@ public class JvmStats implements Streamable, ToXContent {
this.used = used;
}
public BufferPool(StreamInput in) throws IOException {
name = in.readString();
count = in.readLong();
totalCapacity = in.readLong();
used = in.readLong();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
out.writeLong(count);
out.writeLong(totalCapacity);
out.writeLong(used);
}
public String getName() {
return this.name;
}
@ -646,32 +588,13 @@ public class JvmStats implements Streamable, ToXContent {
public ByteSizeValue getUsed() {
return new ByteSizeValue(used);
}
@Override
public void readFrom(StreamInput in) throws IOException {
name = in.readString();
count = in.readLong();
totalCapacity = in.readLong();
used = in.readLong();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
out.writeLong(count);
out.writeLong(totalCapacity);
out.writeLong(used);
}
}
public static class Classes implements Streamable {
public static class Classes implements Writeable {
long loadedClassCount;
long totalLoadedClassCount;
long unloadedClassCount;
Classes() {
}
private final long loadedClassCount;
private final long totalLoadedClassCount;
private final long unloadedClassCount;
public Classes(long loadedClassCount, long totalLoadedClassCount, long unloadedClassCount) {
this.loadedClassCount = loadedClassCount;
@ -679,6 +602,19 @@ public class JvmStats implements Streamable, ToXContent {
this.unloadedClassCount = unloadedClassCount;
}
public Classes(StreamInput in) throws IOException {
loadedClassCount = in.readLong();
totalLoadedClassCount = in.readLong();
unloadedClassCount = in.readLong();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeLong(loadedClassCount);
out.writeLong(totalLoadedClassCount);
out.writeLong(unloadedClassCount);
}
public long getLoadedClassCount() {
return loadedClassCount;
}
@ -690,19 +626,5 @@ public class JvmStats implements Streamable, ToXContent {
public long getUnloadedClassCount() {
return unloadedClassCount;
}
@Override
public void readFrom(StreamInput in) throws IOException {
loadedClassCount = in.readLong();
totalLoadedClassCount = in.readLong();
unloadedClassCount = in.readLong();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeLong(loadedClassCount);
out.writeLong(totalLoadedClassCount);
out.writeLong(unloadedClassCount);
}
}
}