HBASE-21514: Refactor CacheConfig(addendum)

This commit is contained in:
Guanghao Zhang 2018-12-18 16:46:34 +08:00
parent fb58a23e56
commit 8991877bb2
1 changed files with 2 additions and 2 deletions

View File

@ -1300,8 +1300,8 @@ public class HFileReaderImpl implements HFile.Reader, Configurable {
boolean isCompaction, boolean updateCacheMetrics, BlockType expectedBlockType,
DataBlockEncoding expectedDataBlockEncoding) throws IOException {
// Check cache for block. If found return.
if (cacheConf.getBlockCache().isPresent()) {
BlockCache cache = cacheConf.getBlockCache().get();
BlockCache cache = cacheConf.getBlockCache().orElse(null);
if (cache != null) {
HFileBlock cachedBlock =
(HFileBlock) cache.getBlock(cacheKey, cacheBlock, useLock, updateCacheMetrics);
if (cachedBlock != null) {