Class SynchronousLoadingBlockCache
- java.lang.Object
-
- org.apache.accumulo.core.file.blockfile.cache.lru.SynchronousLoadingBlockCache
-
- All Implemented Interfaces:
BlockCache
- Direct Known Subclasses:
LruBlockCache
public abstract class SynchronousLoadingBlockCache extends Object implements BlockCache
This class implements loading in such a way that load operations for the same block will not run concurrently.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.accumulo.core.spi.cache.BlockCache
BlockCache.Loader, BlockCache.Stats
-
-
Constructor Summary
Constructors Constructor Description SynchronousLoadingBlockCache()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CacheEntry
getBlock(String blockName, BlockCache.Loader loader)
This method allows a cache to prevent concurrent loads of the same block.protected abstract CacheEntry
getBlockNoStats(String blockName)
Get a block from the cache without changing any stats the cache is keeping.protected abstract int
getMaxEntrySize()
Get the maximum size of an individual cache entry.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.accumulo.core.spi.cache.BlockCache
cacheBlock, getBlock, getMaxHeapSize, getMaxSize, getStats
-
-
-
-
Method Detail
-
getMaxEntrySize
protected abstract int getMaxEntrySize()
Get the maximum size of an individual cache entry.
-
getBlockNoStats
protected abstract CacheEntry getBlockNoStats(String blockName)
Get a block from the cache without changing any stats the cache is keeping.
-
getBlock
public CacheEntry getBlock(String blockName, BlockCache.Loader loader)
Description copied from interface:BlockCache
This method allows a cache to prevent concurrent loads of the same block. However a cache implementation is not required to prevent concurrent loads.SynchronousLoadingBlockCache
is an abstract class that a cache can extent which does prevent concurrent loading of the same block.- Specified by:
getBlock
in interfaceBlockCache
- Parameters:
blockName
- Block name to fetchloader
- If the block is not present in the cache, the loader can be called to load it.- Returns:
- Block or null if block is not in the cache or didn't load.
-
-