|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.vfs.provider.AbstractVfsComponent
org.apache.commons.vfs.cache.AbstractFilesCache
org.apache.commons.vfs.cache.SoftRefFilesCache
public class SoftRefFilesCache
This implementation caches every file as long as it is strongly reachable by the java vm. As soon as the vm needs memory - every softly reachable file will be discarded.
SoftReference
Nested Class Summary | |
---|---|
private class |
SoftRefFilesCache.SoftRefReleaseThread
This thread will listen on the ReferenceQueue and remove the entry in the filescache as soon as the vm removes the reference |
Field Summary | |
---|---|
private java.util.Map |
filesystemCache
|
private org.apache.commons.logging.Log |
log
The logger to use. |
private java.lang.ref.ReferenceQueue |
refqueue
|
private java.util.Map |
refReverseMap
|
private SoftRefFilesCache.SoftRefReleaseThread |
softRefReleaseThread
|
Constructor Summary | |
---|---|
SoftRefFilesCache()
|
Method Summary | |
---|---|
void |
clear(FileSystem filesystem)
purge the entries corresponding to the filesystem |
void |
close()
Closes the provider. |
protected java.lang.ref.Reference |
createReference(FileObject file,
java.lang.ref.ReferenceQueue refqueue)
|
private void |
endThread()
|
private void |
filesystemClose(FileSystem filesystem)
|
FileObject |
getFile(FileSystem filesystem,
FileName name)
retrieve a file from the cache by its name |
protected java.util.Map |
getOrCreateFilesystemCache(FileSystem filesystem)
|
void |
putFile(FileObject file)
add a fileobject to the cache |
private boolean |
removeFile(FileSystemAndNameKey key)
|
void |
removeFile(FileSystem filesystem,
FileName name)
removes a file from cache |
private void |
startThread()
|
void |
touchFile(FileObject file)
|
Methods inherited from class org.apache.commons.vfs.provider.AbstractVfsComponent |
---|
getContext, getLogger, init, setContext, setLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private org.apache.commons.logging.Log log
private final java.util.Map filesystemCache
private final java.util.Map refReverseMap
private final java.lang.ref.ReferenceQueue refqueue
private SoftRefFilesCache.SoftRefReleaseThread softRefReleaseThread
Constructor Detail |
---|
public SoftRefFilesCache()
Method Detail |
---|
private void startThread()
private void endThread()
public void putFile(FileObject file)
FilesCache
file
- the fileprotected java.lang.ref.Reference createReference(FileObject file, java.lang.ref.ReferenceQueue refqueue)
public FileObject getFile(FileSystem filesystem, FileName name)
FilesCache
name
- the name
public void clear(FileSystem filesystem)
FilesCache
private void filesystemClose(FileSystem filesystem)
public void close()
AbstractVfsComponent
close
in interface FilesCache
close
in interface VfsComponent
close
in class AbstractVfsComponent
public void removeFile(FileSystem filesystem, FileName name)
FilesCache
filesystem
- filesystemname
- filenamepublic void touchFile(FileObject file)
private boolean removeFile(FileSystemAndNameKey key)
protected java.util.Map getOrCreateFilesystemCache(FileSystem filesystem)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |