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 AsynchronousFileCacheBacking
AsynchronousFileCacheBacking.AbstractCommand, AsynchronousFileCacheBacking.AsyncCommand, AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T>, AsynchronousFileCacheBacking.ClearCommand, AsynchronousFileCacheBacking.InsertCommand, AsynchronousFileCacheBacking.KeyedCommand, AsynchronousFileCacheBacking.RemoveCommand, AsynchronousFileCacheBacking.UpdateIndexCommandModifier and TypeClassDescriptionstatic classstatic interfaceRepresents an asynchronous command that can be sent to theAsynchronousFileCacheBackinginstance to be executed on it asynchronouslystatic interfaceAsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T extends AsynchronousFileCacheBacking>static classstatic classstatic classBase class forAsynchronousFileCacheBacking.AbstractCommands that refer to a cache keystatic classstatic classNested classes/interfaces inherited from class AbstractIndexedFileCacheBacking
AbstractIndexedFileCacheBacking.IndexEntryModifier and TypeClassDescriptionstatic classThe default index entry in the index file -
Field Summary
FieldsFields inherited from class AsynchronousFileCacheBacking
bytesMap, exposedBytes, exposedIndex, indexModifier and TypeFieldDescriptionprotected final Map<String, AbstractIndexedFileCacheBacking.IndexEntry> protected final Map<String, AbstractIndexedFileCacheBacking.IndexEntry> Fields inherited from class AbstractIndexedFileCacheBacking
EMPTY_INDEX, EMPTY_KEYS, INDEX_FILEModifier and TypeFieldDescriptionprotected static final AbstractIndexedFileCacheBacking.IndexEntry[]protected static final String[]static final StringDefault name of cache index file - assumed to containAbstractIndexedFileCacheBacking.IndexEntry-sFields inherited from class AbstractFileCacheBacking
WEAVED_CLASS_CACHE_DIRModifier and TypeFieldDescriptionstatic final StringDefault property used to specify a default weaving cache dir locationFields inherited from class AbstractCacheBacking
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final ZippedFileCacheBackingcreateBacking(File cacheDir) readClassBytes(Map<String, AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File cacheDir) readZipClassBytes(File file) protected voidremoveClassBytes(String key) protected booleansyncClassBytesEntries(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 voidwriteClassBytes(String key, byte[] bytes) static final voidwriteZipClassBytes(File file, Map<String, byte[]> entriesMap) Methods inherited from class AsynchronousFileCacheBacking
clear, createBacking, executeClearCommand, executeCommand, executeInsertCommand, executeRemoveCommand, executeUpdateIndexCommand, get, getBytesMap, getIndex, getIndexEntries, getIndexMap, postCacheCommand, put, remove, remove, toStringModifier and TypeMethodDescriptionvoidclear()Clear the entire cacheprotected static final <T extends AsynchronousFileCacheBacking>
TcreateBacking(File cacheDir, AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T> creator) protected voidprotected voidprotected voidprotected voidprotected voidget(CachedClassReference ref, byte[] originalBytes) Get a cache entryprotected Map<String, AbstractIndexedFileCacheBacking.IndexEntry> getIndex()static final booleanvoidput(CachedClassEntry entry, byte[] originalBytes) Put an entry in the cachevoidRemove an entry from the cachetoString()Methods inherited from class AbstractIndexedFileCacheBacking
createIndexEntry, getIndexFile, getKeys, readIndex, readIndex, readIndex, writeIndex, writeIndex, writeIndex, writeIndex, writeIndexModifier and TypeMethodDescriptionstatic final AbstractIndexedFileCacheBacking.IndexEntrycreateIndexEntry(CachedClassEntry classEntry, byte[] originalBytes) String[]Return a list of keys which match the given regex.protected Map<String, AbstractIndexedFileCacheBacking.IndexEntry> protected Map<String, AbstractIndexedFileCacheBacking.IndexEntry> protected voidprotected voidwriteIndex(File file) protected voidwriteIndex(File indexFile, Collection<? extends AbstractIndexedFileCacheBacking.IndexEntry> entries) protected voidwriteIndex(File indexFile, Map<String, ? extends AbstractIndexedFileCacheBacking.IndexEntry> index) protected voidwriteIndex(File indexFile, AbstractIndexedFileCacheBacking.IndexEntry... entries) Methods inherited from class AbstractFileCacheBacking
close, close, delete, getCacheDirectoryModifier and TypeMethodDescriptionprotected voidclose(InputStream in, File file) protected voidclose(OutputStream out, File file) protected voidMethods inherited from class AbstractCacheBacking
crcModifier and TypeMethodDescriptionstatic final longcrc(byte[] bytes) Calculates CRC32 on the provided bytes
-
Field Details
-
ZIP_FILE
- See Also:
-
-
Constructor Details
-
ZippedFileCacheBacking
-
-
Method Details
-
getZipFile
-
createBacking
-
writeClassBytes
- Overrides:
writeClassBytesin classAbstractFileCacheBacking- Throws:
Exception
-
removeClassBytes
Description copied from class:AsynchronousFileCacheBacking- Specified by:
removeClassBytesin 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:
readClassBytesin 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:
resolveIndexMapEntryin classAbstractIndexedFileCacheBacking
-
readZipClassBytes
- Throws:
IOException
-
writeZipClassBytes
public static final void writeZipClassBytes(File file, Map<String, byte[]> entriesMap) throws IOException- Throws:
IOException
-