org.aspectj.weaver.tools.cache
Class FlatFileCacheBacking

java.lang.Object
  extended by org.aspectj.weaver.tools.cache.AbstractCacheBacking
      extended by org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
          extended by org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
              extended by org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking
                  extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking
AsynchronousFileCacheBacking.AbstractCommand, AsynchronousFileCacheBacking.AsyncCommand, AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T extends AsynchronousFileCacheBacking>, AsynchronousFileCacheBacking.ClearCommand, AsynchronousFileCacheBacking.InsertCommand, AsynchronousFileCacheBacking.KeyedCommand, AsynchronousFileCacheBacking.RemoveCommand, AsynchronousFileCacheBacking.UpdateIndexCommand
 
Nested classes/interfaces inherited from class org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
AbstractIndexedFileCacheBacking.IndexEntry
 
Field Summary
 
Fields inherited from class org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking
bytesMap, exposedBytes, exposedIndex, index
 
Fields inherited from class org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
EMPTY_INDEX, EMPTY_KEYS, INDEX_FILE
 
Fields inherited from class org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
WEAVED_CLASS_CACHE_DIR
 
Fields inherited from class org.aspectj.weaver.tools.cache.AbstractCacheBacking
logger
 
Constructor Summary
FlatFileCacheBacking(java.io.File cacheDir)
           
 
Method Summary
static FlatFileCacheBacking createBacking(java.io.File cacheDir)
           
protected  java.util.Map<java.lang.String,byte[]> readClassBytes(java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, java.io.File cacheDir)
           
protected  java.util.Map<java.lang.String,byte[]> readClassBytes(java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, java.io.File[] files)
           
protected  void removeClassBytes(java.lang.String key)
          Helper for AsynchronousFileCacheBacking.executeRemoveCommand(RemoveCommand)
protected  AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)
           
protected  void writeClassBytes(java.lang.String key, byte[] bytes)
           
 
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 org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
close, close, delete, getCacheDirectory
 
Methods inherited from class org.aspectj.weaver.tools.cache.AbstractCacheBacking
crc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FlatFileCacheBacking

public FlatFileCacheBacking(java.io.File cacheDir)
Method Detail

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