Verkar som om jag fixade en NullPointer
- getSystemFileDescriptorsPercentUsed
Showing
1 changed file
with
7 additions
and
3 deletions
... | @@ -392,9 +392,13 @@ public class JmxMon { | ... | @@ -392,9 +392,13 @@ public class JmxMon { |
392 | public double getSystemFileDescriptorsPercentUsed() { | 392 | public double getSystemFileDescriptorsPercentUsed() { |
393 | LongDelta ldo = getAttributeLongDelta("java.lang:type=OperatingSystem", "OpenFileDescriptorCount"); | 393 | LongDelta ldo = getAttributeLongDelta("java.lang:type=OperatingSystem", "OpenFileDescriptorCount"); |
394 | LongDelta ldm = getAttributeLongDelta("java.lang:type=OperatingSystem", "MaxFileDescriptorCount"); | 394 | LongDelta ldm = getAttributeLongDelta("java.lang:type=OperatingSystem", "MaxFileDescriptorCount"); |
395 | double open = ldo.getCurrentValue(); | 395 | if(ldo != null && ldm != null) { |
396 | double max = ldm.getCurrentValue(); | 396 | double open = ldo.getCurrentValue(); |
397 | return (open/max) * 100D; | 397 | double max = ldm.getCurrentValue(); |
398 | return (open/max) * 100D; | ||
399 | } else { | ||
400 | return 0; | ||
401 | } | ||
398 | } | 402 | } |
399 | 403 | ||
400 | public double getHeapUsedMB() { | 404 | public double getHeapUsedMB() { | ... | ... |
-
Please register or sign in to post a comment