Class MmappedRegionsCache

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    @NotThreadSafe
    public class MmappedRegionsCache
    extends java.lang.Object
    implements java.lang.AutoCloseable
    It is a utility class for caching MmappedRegions primarily used by a FileHandle.Builder when a handle to the same file is created multiple times (as when an sstable is opened early).
    • Constructor Detail

      • MmappedRegionsCache

        public MmappedRegionsCache()
    • Method Detail

      • getOrCreate

        public MmappedRegions getOrCreate​(ChannelProxy channel,
                                          long length)
        Looks for mmapped regions in cache. If found, a shared copy is created and extended to the provided length. If mmapped regions do not exist yet for the provided key, they are created and a shared copy is returned.
        Parameters:
        channel - channel for which the mmapped regions are requested
        length - length of the file
        Returns:
        a shared copy of the cached mmapped regions
      • getOrCreate

        public MmappedRegions getOrCreate​(ChannelProxy channel,
                                          CompressionMetadata metadata)
        Looks for mmapped regions in cache. If found, a shared copy is created and extended according to the provided metadata. If mmapped regions do not exist yet for the provided key, they are created and a shared copy is returned.
        Parameters:
        channel - channel for which the mmapped regions are requested
        metadata - compression metadata of the file
        Returns:
        a shared copy of the cached mmapped regions
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable