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.AsyncCommand
s
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.AsyncCommand
is posted to the background thread so that the newly mapped value will be persisted (eventually)
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypKlasseBeschreibungstatic class
static interface
Represents an asynchronous command that can be sent to theAsynchronousFileCacheBacking
instance to be executed on it asynchronouslystatic interface
AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T extends AsynchronousFileCacheBacking>
static class
static class
static class
Base class forAsynchronousFileCacheBacking.AbstractCommand
s that refer to a cache keystatic class
static class
Von Klasse geerbte verschachtelte Klassen/Schnittstellen org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking
AbstractIndexedFileCacheBacking.IndexEntry
-
Feldübersicht
Modifizierer 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_FILE
Von Klasse geerbte Felder org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
WEAVED_CLASS_CACHE_DIR
Von Klasse geerbte Felder org.aspectj.weaver.tools.cache.AbstractCacheBacking
logger
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
clear()
Clear the entire cacheprotected static final <T extends AsynchronousFileCacheBacking>
TcreateBacking
(File cacheDir, AsynchronousFileCacheBacking.AsynchronousFileCacheBackingCreator<T> creator) protected void
protected void
protected void
protected void
protected void
get
(CachedClassReference ref, byte[] originalBytes) Get a cache entryprotected Map
<String, AbstractIndexedFileCacheBacking.IndexEntry> getIndex()
static final boolean
void
put
(CachedClassEntry entry, byte[] originalBytes) Put an entry in the cachereadClassBytes
(Map<String, AbstractIndexedFileCacheBacking.IndexEntry> indexMap, File cacheDir) void
Remove an entry from the cacheprotected abstract void
removeClassBytes
(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, writeIndex
Von Klasse geerbte Methoden org.aspectj.weaver.tools.cache.AbstractFileCacheBacking
close, close, delete, getCacheDirectory, writeClassBytes
Von Klasse geerbte Methoden org.aspectj.weaver.tools.cache.AbstractCacheBacking
crc
-
Felddetails
-
index
-
exposedIndex
-
bytesMap
-
exposedBytes
-
-
Konstruktordetails
-
AsynchronousFileCacheBacking
-
-
Methodendetails
-
getIndex
- Angegeben von:
getIndex
in KlasseAbstractIndexedFileCacheBacking
-
get
Beschreibung aus Schnittstelle kopiert:CacheBacking
Get 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:CacheBacking
Put 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:CacheBacking
Remove an entry from the cache- Parameter:
ref
-
-
remove
-
getIndexEntries
-
getIndexMap
-
getBytesMap
-
clear
public void clear()Beschreibung aus Schnittstelle kopiert:CacheBacking
Clear 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
-