Skip to content

Commit a401560

Browse files
committed
Return -1 if MemoryUsage is null
1 parent bfa1b1f commit a401560

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/util/MemorySizeUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ public static long getOnHeapCacheSize(final Configuration conf) {
243243
}
244244

245245
final MemoryUsage usage = safeGetHeapMemoryUsage();
246-
final long heapMax = usage != null ? usage.getMax() : -1;
246+
if (usage == null) {
247+
return -1;
248+
}
249+
final long heapMax = usage.getMax();
247250
float onHeapCacheFixedSize =
248251
(float) conf.getLong(HConstants.HFILE_ONHEAP_BLOCK_CACHE_FIXED_SIZE_KEY,
249252
HConstants.HFILE_ONHEAP_BLOCK_CACHE_FIXED_SIZE_DEFAULT) / heapMax;

0 commit comments

Comments
 (0)