make sure that mem, cpu and swap are never null in OsStats
This commit is contained in:
parent
5f299ff46f
commit
042675432e
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class OsStats implements Writeable, ToXContent {
|
public class OsStats implements Writeable, ToXContent {
|
||||||
|
|
||||||
|
@ -38,9 +39,9 @@ public class OsStats implements Writeable, ToXContent {
|
||||||
|
|
||||||
public OsStats(long timestamp, Cpu cpu, Mem mem, Swap swap) {
|
public OsStats(long timestamp, Cpu cpu, Mem mem, Swap swap) {
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
this.cpu = cpu;
|
this.cpu = Objects.requireNonNull(cpu, "cpu must not be null");
|
||||||
this.mem = mem;
|
this.mem = Objects.requireNonNull(mem, "mem must not be null");;
|
||||||
this.swap = swap;
|
this.swap = Objects.requireNonNull(swap, "swap must not be null");;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsStats(StreamInput in) throws IOException {
|
public OsStats(StreamInput in) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue