public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking
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...)AsynchronousFileCacheBacking.AbstractCommand, AsynchronousFileCacheBacking.AsyncCommand, AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T extends AsynchronousFileCacheBacking>, AsynchronousFileCacheBacking.ClearCommand, AsynchronousFileCacheBacking.InsertCommand, AsynchronousFileCacheBacking.KeyedCommand, AsynchronousFileCacheBacking.RemoveCommand, AsynchronousFileCacheBacking.UpdateIndexCommand
AbstractIndexedFileCacheBacking.IndexEntry
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ZIP_FILE |
bytesMap, exposedBytes, exposedIndex, index
EMPTY_INDEX, EMPTY_KEYS, INDEX_FILE
WEAVED_CLASS_CACHE_DIR
logger
Constructor and Description |
---|
ZippedFileCacheBacking(java.io.File cacheDir) |
Modifier and Type | Method and Description |
---|---|
static ZippedFileCacheBacking |
createBacking(java.io.File cacheDir) |
java.io.File |
getZipFile() |
protected java.util.Map<java.lang.String,byte[]> |
readClassBytes(java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap,
java.io.File cacheDir) |
static java.util.Map<java.lang.String,byte[]> |
readZipClassBytes(java.io.File file) |
protected void |
removeClassBytes(java.lang.String key)
|
protected AbstractIndexedFileCacheBacking.IndexEntry |
resolveIndexMapEntry(java.io.File cacheDir,
AbstractIndexedFileCacheBacking.IndexEntry ie) |
protected boolean |
syncClassBytesEntries(java.io.File dataFile,
java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap,
java.util.Map<java.lang.String,byte[]> entriesMap) |
protected java.util.Collection<java.lang.String> |
syncIndexEntries(java.io.File dataFile,
java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap,
java.util.Map<java.lang.String,byte[]> entriesMap) |
protected void |
writeClassBytes(java.lang.String key,
byte[] bytes) |
static void |
writeZipClassBytes(java.io.File file,
java.util.Map<java.lang.String,byte[]> entriesMap) |
clear, createBacking, executeClearCommand, executeCommand, executeInsertCommand, executeRemoveCommand, executeUpdateIndexCommand, get, getBytesMap, getIndex, getIndexEntries, getIndexMap, postCacheCommand, put, remove, remove, toString
createIndexEntry, getIndexFile, getKeys, readIndex, readIndex, readIndex, writeIndex, writeIndex, writeIndex, writeIndex, writeIndex
close, close, delete, getCacheDirectory
crc
public static final java.lang.String ZIP_FILE
public java.io.File getZipFile()
public static final ZippedFileCacheBacking createBacking(java.io.File cacheDir)
protected void writeClassBytes(java.lang.String key, byte[] bytes) throws java.lang.Exception
writeClassBytes
in class AbstractFileCacheBacking
java.lang.Exception
protected void removeClassBytes(java.lang.String key) throws java.lang.Exception
AsynchronousFileCacheBacking
removeClassBytes
in class AsynchronousFileCacheBacking
key
- The key representing the class whose bytes are to be removedjava.lang.Exception
- if failed to remove class bytesprotected java.util.Map<java.lang.String,byte[]> readClassBytes(java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, java.io.File cacheDir)
readClassBytes
in class AsynchronousFileCacheBacking
protected java.util.Collection<java.lang.String> syncIndexEntries(java.io.File dataFile, java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, java.util.Map<java.lang.String,byte[]> entriesMap)
protected boolean syncClassBytesEntries(java.io.File dataFile, java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap, java.util.Map<java.lang.String,byte[]> entriesMap)
protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir, AbstractIndexedFileCacheBacking.IndexEntry ie)
resolveIndexMapEntry
in class AbstractIndexedFileCacheBacking
public static final java.util.Map<java.lang.String,byte[]> readZipClassBytes(java.io.File file) throws java.io.IOException
java.io.IOException
public static final void writeZipClassBytes(java.io.File file, java.util.Map<java.lang.String,byte[]> entriesMap) throws java.io.IOException
java.io.IOException