Package org.aspectj.weaver.tools.cache
Class ZippedFileCacheBacking
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.ZippedFileCacheBacking
- All Implemented Interfaces:
CacheBacking
Uses a ZIP file to store the instrumented classes/aspects - each one as a
separate
ZipEntry
. This mechanism is suitable for relatively
large numbers of instrumented classes/aspects (100's and more) since it
holds all of them in a single (ZIP) file. The down side is that any
modifications to the cache require re-writing the entire ZIP file. This
can cause the ZIP file to become corrupted if interrupted in mid-update,
thus requiring the re-population of the cache on next application activation
(though the overhead in this case is not prohibitvely high...)-
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic ZippedFileCacheBacking
createBacking(File cacheDir)
readClassBytes(Map<String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File cacheDir)
readZipClassBytes(File file)
protected void
removeClassBytes(String key)
resolveIndexMapEntry(File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)
protected boolean
syncClassBytesEntries(File dataFile, Map<String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, Map<String,byte[]> entriesMap)
protected Collection<String>
syncIndexEntries(File dataFile, Map<String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, Map<String,byte[]> entriesMap)
protected void
writeClassBytes(String key, byte[] bytes)
static void
writeZipClassBytes(File file, Map<String,byte[]> entriesMap)
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
-
Field Details
-
ZIP_FILE
- See Also:
- Constant Field Values
-
-
Constructor Details
-
ZippedFileCacheBacking
-
-
Method Details
-
getZipFile
-
createBacking
-
writeClassBytes
- Overrides:
writeClassBytes
in classAbstractFileCacheBacking
- Throws:
Exception
-
removeClassBytes
Description copied from class:AsynchronousFileCacheBacking
- Specified by:
removeClassBytes
in classAsynchronousFileCacheBacking
- Parameters:
key
- The key representing the class whose bytes are to be removed- Throws:
Exception
- if failed to remove class bytes
-
readClassBytes
protected Map<String,byte[]> readClassBytes(Map<String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File cacheDir)- Specified by:
readClassBytes
in classAsynchronousFileCacheBacking
-
syncIndexEntries
protected Collection<String> syncIndexEntries(File dataFile, Map<String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, Map<String,byte[]> entriesMap) -
syncClassBytesEntries
-
resolveIndexMapEntry
protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)- Overrides:
resolveIndexMapEntry
in classAbstractIndexedFileCacheBacking
-
readZipClassBytes
- Throws:
IOException
-
writeZipClassBytes
public static final void writeZipClassBytes(File file, Map<String,byte[]> entriesMap) throws IOException- Throws:
IOException
-