Package org.apache.cassandra.io.util
Class MmappedRegionsCache
- java.lang.Object
-
- org.apache.cassandra.io.util.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 cachingMmappedRegions
primarily used by aFileHandle.Builder
when a handle to the same file is created multiple times (as when an sstable is opened early).
-
-
Constructor Summary
Constructors Constructor Description MmappedRegionsCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
MmappedRegions
getOrCreate(ChannelProxy channel, long length)
Looks for mmapped regions in cache.MmappedRegions
getOrCreate(ChannelProxy channel, CompressionMetadata metadata)
Looks for mmapped regions in cache.
-
-
-
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 requestedlength
- 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 requestedmetadata
- compression metadata of the file- Returns:
- a shared copy of the cached mmapped regions
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-