Top Description Fields Constructors Methods
org.aspectj.weaver.tools.cache

public Class FlatFileCacheBacking

extends AsynchronousFileCacheBacking
Class Inheritance
Imports
java.io.File, .FileOutputStream, .IOException, .StreamCorruptedException, java.util.Map, .TreeMap, org.aspectj.util.FileUtil, .LangUtil

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.
Author
Lyor Goldstein

Field Summary

Modifier and TypeField and Description
private static final AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<FlatFileCacheBacking>
Inherited from org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking:
bytesMapexposedBytesexposedIndexindex

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static final FlatFileCacheBacking
createBacking(File cacheDir)

protected Map<String, byte[]>
protected Map<String, byte[]>
protected void
removeClassBytes(String
The key representing the class whose bytes are to be removed
key
)

Implements abstract org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking.removeClassBytes.

Helper for executeRemoveCommand(RemoveCommand)
protected AbstractIndexedFileCacheBacking.IndexEntry
protected void
Inherited from org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking:
clearcreateBackingexecuteClearCommandexecuteCommandexecuteInsertCommandexecuteRemoveCommandexecuteUpdateIndexCommandgetgetBytesMapgetIndexgetIndexEntriesgetIndexMappostCacheCommandputremoveremovetoString

Field Detail

defaultCreatorback to summary
private static final AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<FlatFileCacheBacking> defaultCreator

Constructor Detail

FlatFileCacheBackingback to summary
public FlatFileCacheBacking(File cacheDir)

Method Detail

createBackingback to summary
public static final FlatFileCacheBacking createBacking(File cacheDir)
readClassBytesback to summary
protected Map<String, byte[]> readClassBytes(Map<String, AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File cacheDir)

Implements abstract org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking.readClassBytes.

Annotations
@Override
readClassBytesback to summary
protected Map<String, byte[]> readClassBytes(Map<String, AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File[] files)
removeClassBytesback to summary
protected void removeClassBytes(String key) throws Exception

Implements abstract org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking.removeClassBytes.

Doc from org.aspectj.weaver.tools.cache.AsynchronousFileCacheBacking.removeClassBytes.

Helper for executeRemoveCommand(RemoveCommand)

Parameters
key:String

The key representing the class whose bytes are to be removed

Annotations
@Override
Exceptions
Exception:
if failed to remove class bytes
resolveIndexMapEntryback to summary
protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)

Overrides org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking.resolveIndexMapEntry.

Annotations
@Override
writeClassBytesback to summary
protected void writeClassBytes(String key, byte[] bytes) throws Exception

Overrides org.aspectj.weaver.tools.cache.AbstractFileCacheBacking.writeClassBytes.

Annotations
@Override