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>cacheprotected static LoggercacheLogprotected AtomicIntegercleanupsprotected ConcurrentHashMap<FileCacheable,MemoryMappedFileCache.CacheElement.CacheFile>filesprotected inthardLimitprotected AtomicBooleanhasScheduledprotected AtomicIntegerhitsprotected static Loggerlogprotected intminElementsprotected AtomicIntegermissprotected Stringnameprotected longperiodprotected intsoftLimitprotected ConcurrentHashMap<Object,MemoryMappedFileCache.CacheTracking>trackprotected booleantrackAll
-
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 FileCacheableacquire(FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject)FileCacheableacquire(FileFactory factory, DatasetUrl durl)protected voidaddRaf(String uriString, MemoryMappedRandomAccessFile mmraf)voidclearCache(boolean force)voiddisable()voideject(Object hashKey)voidenable()booleanrelease(FileCacheable ncfile)voidresetTracking()List<String>showCache()voidshowCache(Formatter format)voidshowStats(Formatter format)voidshowTracking(Formatter format)static voidshutdown()
-
-
-
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:
disablein interfaceFileCacheIF
-
enable
public void enable()
- Specified by:
enablein interfaceFileCacheIF
-
acquire
public FileCacheable acquire(FileFactory factory, DatasetUrl durl) throws IOException- Specified by:
acquirein interfaceFileCacheIF- Throws:
IOException
-
acquire
public FileCacheable acquire(FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException- Specified by:
acquirein interfaceFileCacheIF- Throws:
IOException
-
eject
public void eject(Object hashKey)
- Specified by:
ejectin interfaceFileCacheIF
-
release
public boolean release(FileCacheable ncfile) throws IOException- Specified by:
releasein interfaceFileCacheIF- Throws:
IOException
-
clearCache
public void clearCache(boolean force)
- Specified by:
clearCachein interfaceFileCacheIF
-
showCache
public void showCache(Formatter format)
- Specified by:
showCachein interfaceFileCacheIF
-
showStats
public void showStats(Formatter format)
- Specified by:
showStatsin interfaceFileCacheIF
-
showTracking
public void showTracking(Formatter format)
- Specified by:
showTrackingin interfaceFileCacheIF
-
resetTracking
public void resetTracking()
- Specified by:
resetTrackingin interfaceFileCacheIF
-
-