Package org.aspectj.weaver.tools.cache
Klasse AsynchronousFileCacheBacking
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
- Alle implementierten Schnittstellen:
CacheBacking
- Bekannte direkte Unterklassen:
FlatFileCacheBacking,ZippedFileCacheBacking
Uses a background thread to do the actual I/O and for caching "persistence"
so that the caching works faster on repeated activations of the application.
The class maintains an in-memory cache, and uses a queue of
AsynchronousFileCacheBacking.AsyncCommands
to signal to a background thread various actions required to "synchronize"
the in-memory cache with the persisted copy. Whenever there is a cache miss
from the get(CachedClassReference, byte[]) call, the weaver issues a
put(CachedClassEntry, byte[]) call. This call has 2 side-effects:
-
The in-memory cache is updated so that subsequent calls to
get(CachedClassReference, byte[])will not return the mapped value. -
An "update index"
AsynchronousFileCacheBacking.AsyncCommandis posted to the background thread so that the newly mapped value will be persisted (eventually)
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic 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 classVon Klasse geerbte verschachtelte Klassen/Schnittstellen org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
AbstractIndexedFileCacheBacking.IndexEntry -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected final Map<String, AbstractIndexedFileCacheBacking.IndexEntry> protected final Map<String, AbstractIndexedFileCacheBacking.IndexEntry> Von Klasse geerbte Felder org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
EMPTY_INDEX, EMPTY_KEYS, INDEX_FILEVon Klasse geerbte Felder org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
WEAVED_CLASS_CACHE_DIRVon Klasse geerbte Felder org.aspectj.weaver.tools.cache.AbstractCacheBacking
logger -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclear()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 cachereadClassBytes(Map<String, AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File cacheDir) voidRemove an entry from the cacheprotected abstract voidremoveClassBytes(String key) Helper forexecuteRemoveCommand(RemoveCommand)toString()Von Klasse geerbte Methoden org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
createIndexEntry, getIndexFile, getKeys, readIndex, readIndex, readIndex, resolveIndexMapEntry, writeIndex, writeIndex, writeIndex, writeIndex, writeIndexVon Klasse geerbte Methoden org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
close, close, delete, getCacheDirectory, writeClassBytesVon Klasse geerbte Methoden org.aspectj.weaver.tools.cache.AbstractCacheBacking
crc
-
Felddetails
-
index
-
exposedIndex
-
bytesMap
-
exposedBytes
-
-
Konstruktordetails
-
AsynchronousFileCacheBacking
-
-
Methodendetails
-
getIndex
- Angegeben von:
getIndexin KlasseAbstractIndexedFileCacheBacking
-
get
Beschreibung aus Schnittstelle kopiert:CacheBackingGet a cache entry- Parameter:
ref- entry to retrieveoriginalBytes- Pre-weaving class bytes - required in order to ensure that the cached entry refers to the same original class- Gibt zurück:
- the cached bytes or null, if the entry does not exist
-
put
Beschreibung aus Schnittstelle kopiert:CacheBackingPut an entry in the cache- Parameter:
entry- key of the entryoriginalBytes- Pre-weaving class bytes - required in order to ensure that the cached entry refers to the same original class
-
remove
Beschreibung aus Schnittstelle kopiert:CacheBackingRemove an entry from the cache- Parameter:
ref-
-
remove
-
getIndexEntries
-
getIndexMap
-
getBytesMap
-
clear
public void clear()Beschreibung aus Schnittstelle kopiert:CacheBackingClear the entire cache -
executeCommand
- Löst aus:
Exception
-
executeClearCommand
- Löst aus:
Exception
-
executeUpdateIndexCommand
- Löst aus:
Exception
-
executeInsertCommand
protected void executeInsertCommand(AsynchronousFileCacheBacking.InsertCommand cmd) throws Exception - Löst aus:
Exception
-
executeRemoveCommand
protected void executeRemoveCommand(AsynchronousFileCacheBacking.RemoveCommand cmd) throws Exception - Löst aus:
Exception
-
removeClassBytes
Helper forexecuteRemoveCommand(RemoveCommand)- Parameter:
key- The key representing the class whose bytes are to be removed- Löst aus:
Exception- if failed to remove class bytes
-
readClassBytes
-
toString
-
createBacking
protected static final <T extends AsynchronousFileCacheBacking> T createBacking(File cacheDir, AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T> creator) -
postCacheCommand
-