@@ -69,29 +69,18 @@ public Set<ElasticsearchNodeInfo> getNodeInfos() {
6969 continue ;
7070 }
7171
72- final HostInfo .Cpu cpu ;
73- final HostInfo .Memory memory ;
74- final HostInfo .Memory swap ;
75- if (info .getOs () != null ) {
76- cpu = HostInfo .Cpu .create (
77- info .getOs ().cpu ().model (),
78- info .getOs ().cpu ().vendor (),
79- info .getOs ().cpu ().mhz (),
80- info .getOs ().cpu ().totalCores (),
81- info .getOs ().cpu ().totalSockets (),
82- info .getOs ().cpu ().coresPerSocket (),
83- info .getOs ().cpu ().cacheSize ().bytes ()
84- );
85- memory = HostInfo .Memory .create (info .getOs ().mem ().total ().bytes ());
86- swap = HostInfo .Memory .create (info .getOs ().swap ().total ().bytes ());
87-
88- } else {
89- cpu = null ;
90- memory = null ;
91- swap = null ;
92- }
93-
9472 final MacAddress macAddress = info .getNetwork () == null ? MacAddress .EMPTY : MacAddress .create (info .getNetwork ().primaryInterface ().macAddress ());
73+ final HostInfo .Cpu cpu = info .getOs ().cpu () == null ? null : HostInfo .Cpu .create (
74+ info .getOs ().cpu ().model (),
75+ info .getOs ().cpu ().vendor (),
76+ info .getOs ().cpu ().mhz (),
77+ info .getOs ().cpu ().totalCores (),
78+ info .getOs ().cpu ().totalSockets (),
79+ info .getOs ().cpu ().coresPerSocket (),
80+ info .getOs ().cpu ().cacheSize ().bytes ()
81+ );
82+ final HostInfo .Memory memory = info .getOs ().mem () == null ? null : HostInfo .Memory .create (info .getOs ().mem ().total ().bytes ());
83+ final HostInfo .Memory swap = info .getOs ().swap () == null ? null : HostInfo .Memory .create (info .getOs ().swap ().total ().bytes ());
9584 final HostInfo hostInfo = HostInfo .create (macAddress , cpu , memory , swap );
9685
9786 final List <String > garbageCollectors ;
0 commit comments