org.aspectj.weaver.tools.cache
Class FlatFileCacheBacking
java.lang.Object
org.aspectj.weaver.tools.cache.AbstractCacheBacking
org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking
org.aspectj.weaver.tools.cache.FlatFileCacheBacking
- All Implemented Interfaces:
- CacheBacking
public class FlatFileCacheBacking
- extends AsynchronousFileCacheBacking
Uses a "flat" files model to store the cached instrumented classes
and aspects - i.e., each class/aspect is stored as a separate (binary)
file. This is a good mechanism when the number of instrumented class is
relatively small (a few 10's). The reason for it is that scanning a folder
that has many files in it quickly becomes an I/O bottleneck. Also, some
O/S-es may impose internal limits on the maximum number of "children"
a folder node may have. On the other hand, it is much faster (again, for
small number of instrumented classes) than the ZIP cache since each class/aspect
is represented by a single file - thus adding/removing/modifying it is easier.
Methods inherited from class org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking |
clear, createBacking, executeClearCommand, executeCommand, executeInsertCommand, executeRemoveCommand, executeUpdateIndexCommand, get, getBytesMap, getIndex, getIndexEntries, getIndexMap, postCacheCommand, put, remove, remove, toString |
Methods inherited from class org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking |
createIndexEntry, getIndexFile, getKeys, readIndex, readIndex, readIndex, writeIndex, writeIndex, writeIndex, writeIndex, writeIndex |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FlatFileCacheBacking
public FlatFileCacheBacking(java.io.File cacheDir)
createBacking
public static final FlatFileCacheBacking createBacking(java.io.File cacheDir)
readClassBytes
protected java.util.Map<java.lang.String,byte[]> readClassBytes(java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap,
java.io.File cacheDir)
- Specified by:
readClassBytes
in class AsynchronousFileCacheBacking
readClassBytes
protected java.util.Map<java.lang.String,byte[]> readClassBytes(java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap,
java.io.File[] files)
resolveIndexMapEntry
protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir,
AbstractIndexedFileCacheBacking.IndexEntry ie)
- Overrides:
resolveIndexMapEntry
in class AbstractIndexedFileCacheBacking
writeClassBytes
protected void writeClassBytes(java.lang.String key,
byte[] bytes)
throws java.lang.Exception
- Overrides:
writeClassBytes
in class AbstractFileCacheBacking
- Throws:
java.lang.Exception
removeClassBytes
protected void removeClassBytes(java.lang.String key)
throws java.lang.Exception
- Description copied from class:
AsynchronousFileCacheBacking
- Helper for
AsynchronousFileCacheBacking.executeRemoveCommand(RemoveCommand)
- Specified by:
removeClassBytes
in class AsynchronousFileCacheBacking
- Parameters:
key
- The key representing the class whose bytes are to be removed
- Throws:
java.lang.Exception
- if failed to remove class bytes