Package org.geotools.io
Class MemoryMappedFileCache
- Object
-
- MemoryMappedFileCache
-
- All Implemented Interfaces:
FileCacheIF
@ThreadSafe public class MemoryMappedFileCache extends Object implements FileCacheIF
-
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentHashMap<Object,MemoryMappedFileCache.CacheElement>
cache
protected static Logger
cacheLog
protected AtomicInteger
cleanups
protected ConcurrentHashMap<FileCacheable,MemoryMappedFileCache.CacheElement.CacheFile>
files
protected int
hardLimit
protected AtomicBoolean
hasScheduled
protected AtomicInteger
hits
protected static Logger
log
protected int
minElements
protected AtomicInteger
miss
protected String
name
protected long
period
protected int
softLimit
protected ConcurrentHashMap<Object,MemoryMappedFileCache.CacheTracking>
track
protected boolean
trackAll
-
Constructor Summary
Constructors Constructor Description MemoryMappedFileCache(int minElementsInMemory, int maxElementsInMemory, int period)
MemoryMappedFileCache(int minElementsInMemory, int softLimit, int hardLimit, int period)
MemoryMappedFileCache(String name, int minElementsInMemory, int softLimit, int hardLimit, int period)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FileCacheable
acquire(FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject)
FileCacheable
acquire(FileFactory factory, DatasetUrl durl)
protected void
addRaf(String uriString, MemoryMappedRandomAccessFile mmraf)
void
clearCache(boolean force)
void
disable()
void
eject(Object hashKey)
void
enable()
boolean
release(FileCacheable ncfile)
void
resetTracking()
List<String>
showCache()
void
showCache(Formatter format)
void
showStats(Formatter format)
void
showTracking(Formatter format)
static void
shutdown()
-
-
-
Field Detail
-
log
protected static final Logger log
-
cacheLog
protected static final Logger cacheLog
-
name
protected String name
-
softLimit
protected final int softLimit
-
minElements
protected final int minElements
-
hardLimit
protected final int hardLimit
-
period
protected final long period
-
hasScheduled
protected final AtomicBoolean hasScheduled
-
cache
protected final ConcurrentHashMap<Object,MemoryMappedFileCache.CacheElement> cache
-
files
protected final ConcurrentHashMap<FileCacheable,MemoryMappedFileCache.CacheElement.CacheFile> files
-
cleanups
protected final AtomicInteger cleanups
-
hits
protected final AtomicInteger hits
-
miss
protected final AtomicInteger miss
-
track
protected ConcurrentHashMap<Object,MemoryMappedFileCache.CacheTracking> track
-
trackAll
protected boolean trackAll
-
-
Constructor Detail
-
MemoryMappedFileCache
public MemoryMappedFileCache(int minElementsInMemory, int maxElementsInMemory, int period)
-
MemoryMappedFileCache
public MemoryMappedFileCache(int minElementsInMemory, int softLimit, int hardLimit, int period)
-
MemoryMappedFileCache
public MemoryMappedFileCache(String name, int minElementsInMemory, int softLimit, int hardLimit, int period)
-
-
Method Detail
-
shutdown
public static void shutdown()
-
addRaf
protected void addRaf(String uriString, MemoryMappedRandomAccessFile mmraf)
-
disable
public void disable()
- Specified by:
disable
in interfaceFileCacheIF
-
enable
public void enable()
- Specified by:
enable
in interfaceFileCacheIF
-
acquire
public FileCacheable acquire(FileFactory factory, DatasetUrl durl) throws IOException
- Specified by:
acquire
in interfaceFileCacheIF
- Throws:
IOException
-
acquire
public FileCacheable acquire(FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException
- Specified by:
acquire
in interfaceFileCacheIF
- Throws:
IOException
-
eject
public void eject(Object hashKey)
- Specified by:
eject
in interfaceFileCacheIF
-
release
public boolean release(FileCacheable ncfile) throws IOException
- Specified by:
release
in interfaceFileCacheIF
- Throws:
IOException
-
clearCache
public void clearCache(boolean force)
- Specified by:
clearCache
in interfaceFileCacheIF
-
showCache
public void showCache(Formatter format)
- Specified by:
showCache
in interfaceFileCacheIF
-
showStats
public void showStats(Formatter format)
- Specified by:
showStats
in interfaceFileCacheIF
-
showTracking
public void showTracking(Formatter format)
- Specified by:
showTracking
in interfaceFileCacheIF
-
resetTracking
public void resetTracking()
- Specified by:
resetTracking
in interfaceFileCacheIF
-
-