Class SynchronousLoadingBlockCache

  • All Implemented Interfaces:
    Direct Known Subclasses:

    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.
    • Constructor Detail

      • SynchronousLoadingBlockCache

        public SynchronousLoadingBlockCache()
    • 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 interface BlockCache
        blockName - Block name to fetch
        loader - If the block is not present in the cache, the loader can be called to load it.
        Block or null if block is not in the cache or didn't load.