Search in sources :

Example 1 with FileFilterInputStreamCache

use of org.exist.util.io.FileFilterInputStreamCache in project exist by eXist-db.

the class BinaryValues method getCacheInstances.

@Override
public List<BinaryInputStreamCacheInfo> getCacheInstances() {
    final FilterInputStreamCacheMonitor monitor = FilterInputStreamCacheMonitor.getInstance();
    final Collection<FilterInputStreamCacheInfo> cacheInstances = monitor.getActive();
    final List<BinaryInputStreamCacheInfo> results = new ArrayList<>();
    for (final FilterInputStreamCacheInfo cacheInstance : cacheInstances) {
        final BinaryInputStreamCacheInfo result;
        final FilterInputStreamCache cache = cacheInstance.getCache();
        if (cache instanceof FileFilterInputStreamCache) {
            result = new BinaryInputStreamCacheInfo(CacheType.FILE, cacheInstance.getRegistered(), Optional.of(((FileFilterInputStreamCache) cache).getFilePath()), cache.getLength());
        } else if (cache instanceof MemoryMappedFileFilterInputStreamCache) {
            result = new BinaryInputStreamCacheInfo(CacheType.MEMORY_MAPPED_FILE, cacheInstance.getRegistered(), Optional.of(((MemoryMappedFileFilterInputStreamCache) cache).getFilePath()), cache.getLength());
        } else {
            result = new BinaryInputStreamCacheInfo(CacheType.MEMORY, cacheInstance.getRegistered(), Optional.empty(), cache.getLength());
        }
        results.add(result);
    }
    return results;
}
Also used : FilterInputStreamCacheMonitor(org.exist.util.io.FilterInputStreamCacheMonitor) ArrayList(java.util.ArrayList) FilterInputStreamCacheInfo(org.exist.util.io.FilterInputStreamCacheMonitor.FilterInputStreamCacheInfo) FileFilterInputStreamCache(org.exist.util.io.FileFilterInputStreamCache) FilterInputStreamCache(org.exist.util.io.FilterInputStreamCache) MemoryMappedFileFilterInputStreamCache(org.exist.util.io.MemoryMappedFileFilterInputStreamCache) MemoryMappedFileFilterInputStreamCache(org.exist.util.io.MemoryMappedFileFilterInputStreamCache) FileFilterInputStreamCache(org.exist.util.io.FileFilterInputStreamCache) MemoryMappedFileFilterInputStreamCache(org.exist.util.io.MemoryMappedFileFilterInputStreamCache)

Aggregations

ArrayList (java.util.ArrayList)1 FileFilterInputStreamCache (org.exist.util.io.FileFilterInputStreamCache)1 FilterInputStreamCache (org.exist.util.io.FilterInputStreamCache)1 FilterInputStreamCacheMonitor (org.exist.util.io.FilterInputStreamCacheMonitor)1 FilterInputStreamCacheInfo (org.exist.util.io.FilterInputStreamCacheMonitor.FilterInputStreamCacheInfo)1 MemoryMappedFileFilterInputStreamCache (org.exist.util.io.MemoryMappedFileFilterInputStreamCache)1