|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.cache.WeakReferenceGlobalLRU
public class WeakReferenceGlobalLRU
Implementation based on a shared HardReferenceQueue and
WeakReferences in per-store ConcurrentWeakValueCache
instances.
This implementation IS NOT recommended. First, there is no need for the use
of WeakReferences to manage the cache. Second, the very large ring
buffer allows lots of duplicates and therefore can not make efficient use of
memory (it can under fill the allocated buffer space, which makes
configuration and more haphazard, and the eviction of an entry from the cache
is somewhat unpredictable because the cache contains duplicates). The other
problem with this implementation is that it requires an estimate of the
average record size to pre-size the backing ring buffer, and the record size
can vary quite a bit by application, coding, and branching factor. The
alternative implementations do not have this limitation.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.bigdata.cache.IGlobalLRU |
|---|
IGlobalLRU.IGlobalLRUCounters, IGlobalLRU.ILRUCache<K,V> |
| Constructor Summary | |
|---|---|
WeakReferenceGlobalLRU(long maximumMemoryFootprint,
int minimumCacheSetCapacity,
int queueCapacity,
int nscan,
int initialCapacity,
float loadFactor,
int concurrencyLevel)
Constructor with caller specified parameters. |
|
| Method Summary | |
|---|---|
void |
deleteCache(UUID uuid)
Remove the cache for the IRawStore from the set of caches
maintained by this class and clear any entries in that cache. |
void |
discardAllCaches()
Discard all hard reference in the #getGlobalLRU(). |
IGlobalLRU.ILRUCache<Long,Object> |
getCache(UUID uuid,
IAddressManager am)
An canonicalizing factory for cache instances supporting random access to decompressed IDataRecords, higher-level data structures wrapping
those decompressed data records (INodeData and ILeafData
), or objects deserialized from those IDataRecords. |
CounterSet |
getCounterSet()
The counters for the global LRU. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WeakReferenceGlobalLRU(long maximumMemoryFootprint,
int minimumCacheSetCapacity,
int queueCapacity,
int nscan,
int initialCapacity,
float loadFactor,
int concurrencyLevel)
maximumMemoryFootprint - The maximum in-memory footprint for the buffered
IDataRecordAccess objects.minimumCacheSetCapacity - The #of caches for which we will force retention. E.g., a
value of N implies that hard references will be retained to
the LRU cache for N stores. In practice, stores will typically
hold a hard reference to their LRU cache instance so many more
LRU cache instances MAY be retained.queueCapacity - The IHardReferenceQueue capacity.nscan - The #of entries on the IHardReferenceQueue to scan for
a match before adding a reference.initialCapacity - The initial capacity of the per-store hash maps.loadFactor - The load factor for the per store hash maps.concurrencyLevel - The concurrency level of the per-store hash maps.| Method Detail |
|---|
public IGlobalLRU.ILRUCache<Long,Object> getCache(UUID uuid,
IAddressManager am)
IGlobalLRUIDataRecords, higher-level data structures wrapping
those decompressed data records (INodeData and ILeafData
), or objects deserialized from those IDataRecords.
getCache in interface IGlobalLRU<Long,Object>uuid - The store's UUID.am - The IAddressManager for that store (optional, but used
to compute the bytes on disk for record and hence highly
desired).
AbstractBTree.readNodeOrLeaf(long),
IndexSegmentStore.reopen(),
LRUNexus.getCache(IRawStore)public void deleteCache(UUID uuid)
IGlobalLRUIRawStore from the set of caches
maintained by this class and clear any entries in that cache. This method
SHOULD be used when the persistent resources for the store are deleted.
It SHOULD NOT be used if a store is simply closed in a context when the
store COULD be re-opened. In such cases, the cache for that store will be
automatically released after it has become only weakly reachable.
deleteCache in interface IGlobalLRU<Long,Object>uuid - The store's UUID.IRawStore.destroy(),
IRawStore.deleteResources()public void discardAllCaches()
#getGlobalLRU(). The per-store
caches are not deleted, but they will empty as their weak references are
cleared by the JVM. Depending on the garbage collector, the JVM may delay
clearing weak references for objects in the old generation until the next
full GC. The LRUCounters will be updated as the entries are
cleared from the backing weak reference value maps.
discardAllCaches in interface IGlobalLRU<Long,Object>public CounterSet getCounterSet()
IGlobalLRU
getCounterSet in interface IGlobalLRU<Long,Object>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||