com.bigdata.cache
Class HardReferenceGlobalLRU<K,V>

java.lang.Object
  extended by com.bigdata.cache.HardReferenceGlobalLRU<K,V>
Type Parameters:
K - The generic type of the key.
V - The generic type of the value.
All Implemented Interfaces:
IGlobalLRU<K,V>, IHardReferenceGlobalLRU<K,V>

Deprecated. This implementation is not used.

public class HardReferenceGlobalLRU<K,V>
extends Object
implements IHardReferenceGlobalLRU<K,V>

A canonicalizing collection of weakly held hard reference hash maps backed by a single Least Recently Used (LRU) ordering over entries. This is used to impose a shared LRU policy on the cache for a set of IRawStores. This implementation DOES NOT recycle the LRU Entry when it is evicted and therefore DOES NOT require us to obtain the lock before testing the inner LRUCacheImpl's map. In order to allow concurrent tests on that map, a ConcurrentHashMap is used. This allows higher concurrency on LRUCacheImpl#get(Object)l, but trades off by having a slower iterator. When compared to the HardReferenceGlobalLRURecycler, this implementation has approximately 10% higher throughput.

Version:
$Id: HardReferenceGlobalLRU.java 2799 2010-05-11 21:04:43Z thompsonbry $
Author:
Bryan Thompson
TODO:
... Disallow anything where does not extend IDataRecordAccess since we can not measure the bytesInMemory for those objects and hence the LRU eviction policy will not account for their memory footprint?

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bigdata.cache.IGlobalLRU
IGlobalLRU.IGlobalLRUCounters, IGlobalLRU.ILRUCache<K,V>
 
Constructor Summary
HardReferenceGlobalLRU(long maximumBytesInMemory, int minimumCacheSetCapacity, int initialCacheCapacity, float loadFactor)
          Deprecated.  
HardReferenceGlobalLRU(LRUNexus.CacheSettings s)
          Deprecated. The designated constructor used by LRUNexus.CacheSettings.
 
Method Summary
 void deleteCache(UUID uuid)
          Deprecated. Remove the cache for the IRawStore from the set of caches maintained by this class and clear any entries in that cache.
 void discardAllCaches()
          Deprecated. Clear all per-IRawStore cache instances.
 long getBytesInMemory()
          Deprecated. The #of bytes in memory across all cache instances.
 long getBytesOnDisk()
          Deprecated. The #of bytes on the disk for the records in memory across all cache instances.
 IGlobalLRU.ILRUCache<K,V> getCache(UUID uuid, IAddressManager am)
          Deprecated. Canonicalizing mapping and factory for a per-IRawStore cache instance.
 int getCacheSetSize()
          Deprecated. Return the #of cache instances.
 CounterSet getCounterSet()
          Deprecated. The counters for the global LRU.
 long getEvictionCount()
          Deprecated. The #of records which have been evicted from memory to date across all cache instances.
 long getMaximumBytesInMemory()
          Deprecated. The configured value for the maximum #of bytes in memory across all cache instances.
 int getRecordCount()
          Deprecated. The #of records in memory across all cache instances.
 String toString()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HardReferenceGlobalLRU

public HardReferenceGlobalLRU(LRUNexus.CacheSettings s)
Deprecated. 
The designated constructor used by LRUNexus.CacheSettings.

Parameters:
s - The LRUNexus.CacheSettings.

HardReferenceGlobalLRU

public HardReferenceGlobalLRU(long maximumBytesInMemory,
                              int minimumCacheSetCapacity,
                              int initialCacheCapacity,
                              float loadFactor)
Deprecated. 
Parameters:
maximumBytesInMemory - The maximum bytes in memory for the cached records across all cache instances.
minimumCacheSetCapacity - The #of per-IRawStore ILRUCache instances that will be maintained by hard references unless their cache is explicitly discarded.
initialCacheCapacity - The initial capacity of each new cache instance.
loadFactor - The load factor for the cache instances.
Method Detail

getCache

public IGlobalLRU.ILRUCache<K,V> getCache(UUID uuid,
                                          IAddressManager am)
Deprecated. 
Canonicalizing mapping and factory for a per-IRawStore cache instance.

Specified by:
getCache in interface IGlobalLRU<K,V>
Parameters:
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).
Returns:
The cache for records in the store.
See Also:
AbstractBTree.readNodeOrLeaf(long), IndexSegmentStore.reopen(), LRUNexus.getCache(IRawStore)

getRecordCount

public int getRecordCount()
Deprecated. 
Description copied from interface: IGlobalLRU
The #of records in memory across all cache instances.

Specified by:
getRecordCount in interface IGlobalLRU<K,V>

getEvictionCount

public long getEvictionCount()
Deprecated. 
Description copied from interface: IGlobalLRU
The #of records which have been evicted from memory to date across all cache instances.

Specified by:
getEvictionCount in interface IGlobalLRU<K,V>

getBytesOnDisk

public long getBytesOnDisk()
Deprecated. 
Description copied from interface: IGlobalLRU
The #of bytes on the disk for the records in memory across all cache instances.

Specified by:
getBytesOnDisk in interface IGlobalLRU<K,V>

getBytesInMemory

public long getBytesInMemory()
Deprecated. 
Description copied from interface: IGlobalLRU
The #of bytes in memory across all cache instances.

Specified by:
getBytesInMemory in interface IGlobalLRU<K,V>

getMaximumBytesInMemory

public long getMaximumBytesInMemory()
Deprecated. 
Description copied from interface: IGlobalLRU
The configured value for the maximum #of bytes in memory across all cache instances.

Specified by:
getMaximumBytesInMemory in interface IGlobalLRU<K,V>

getCacheSetSize

public int getCacheSetSize()
Deprecated. 
Description copied from interface: IGlobalLRU
Return the #of cache instances.

Specified by:
getCacheSetSize in interface IGlobalLRU<K,V>

deleteCache

public void deleteCache(UUID uuid)
Deprecated. 
Description copied from interface: IGlobalLRU
Remove the cache for the IRawStore 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. The method DOES NOT guarantee consistency if there are concurrent requests against that cache instance.

Specified by:
deleteCache in interface IGlobalLRU<K,V>
Parameters:
uuid - The store's UUID.
See Also:
IRawStore.destroy(), IRawStore.deleteResources()

discardAllCaches

public void discardAllCaches()
Deprecated. 
Description copied from interface: IGlobalLRU
Clear all per-IRawStore cache instances. This may be used if all bigdata instances in the JVM are closed, but SHOULD NOT be invoked if you are just closing some IRawStore. The method DOES NOT guarantee consistency if there are concurrent requests against the IGlobalLRU.

Specified by:
discardAllCaches in interface IGlobalLRU<K,V>

getCounterSet

public CounterSet getCounterSet()
Deprecated. 
Description copied from interface: IGlobalLRU
The counters for the global LRU.

Specified by:
getCounterSet in interface IGlobalLRU<K,V>

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.