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
public class ZippedFileCacheBacking
- extends AsynchronousFileCacheBacking
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...)
Field Summary |
static java.lang.String |
ZIP_FILE
|
Method Summary |
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)
Helper for AsynchronousFileCacheBacking.executeRemoveCommand(RemoveCommand) |
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)
|
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 |
ZIP_FILE
public static final java.lang.String ZIP_FILE
- See Also:
- Constant Field Values
ZippedFileCacheBacking
public ZippedFileCacheBacking(java.io.File cacheDir)
getZipFile
public java.io.File getZipFile()
createBacking
public static final ZippedFileCacheBacking createBacking(java.io.File cacheDir)
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
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
syncIndexEntries
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)
syncClassBytesEntries
protected boolean syncClassBytesEntries(java.io.File dataFile,
java.util.Map<java.lang.String,AbstractIndexedFileCacheBacking.IndexEntry> indexMap,
java.util.Map<java.lang.String,byte[]> entriesMap)
resolveIndexMapEntry
protected AbstractIndexedFileCacheBacking.IndexEntry resolveIndexMapEntry(java.io.File cacheDir,
AbstractIndexedFileCacheBacking.IndexEntry ie)
- Overrides:
resolveIndexMapEntry
in class AbstractIndexedFileCacheBacking
readZipClassBytes
public static final java.util.Map<java.lang.String,byte[]> readZipClassBytes(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
writeZipClassBytes
public static final void writeZipClassBytes(java.io.File file,
java.util.Map<java.lang.String,byte[]> entriesMap)
throws java.io.IOException
- Throws:
java.io.IOException