public class SelectableConcurrentHashMap extends Object
The random sampling technique involves randomly selecting a map Segment, and then selecting a number of random entry chains from that segment.
Modifier and Type | Class and Description |
---|---|
protected static class |
SelectableConcurrentHashMap.DummyPinnedKey |
protected static class |
SelectableConcurrentHashMap.DummyPinnedValue |
static class |
SelectableConcurrentHashMap.HashEntry |
class |
SelectableConcurrentHashMap.Segment |
Modifier and Type | Field and Description |
---|---|
protected static Element |
DUMMY_PINNED_ELEMENT |
Constructor and Description |
---|
SelectableConcurrentHashMap(PoolAccessor poolAccessor,
boolean elementPinningEnabled,
int initialCapacity,
float loadFactor,
int concurrency,
long maximumSize,
RegisteredEventListeners cacheEventNotificationService) |
SelectableConcurrentHashMap(PoolAccessor poolAccessor,
boolean elementPinningEnabled,
int concurrency,
long maximumSize,
RegisteredEventListeners cacheEventNotificationService) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
protected SelectableConcurrentHashMap.Segment |
createSegment(int initialCapacity,
float lf) |
Set<Map.Entry<Object,Element>> |
entrySet() |
boolean |
evict() |
Element |
get(Object key) |
Element[] |
getRandomValues(int size,
Object keyHint) |
protected static int |
hash(int h) |
boolean |
isEmpty() |
boolean |
isPinned(Object key) |
Set<Object> |
keySet() |
ReentrantReadWriteLock |
lockFor(Object key) |
ReentrantReadWriteLock[] |
locks() |
Set |
pinnedKeySet() |
int |
pinnedSize() |
Element |
put(Object key,
Element element,
long sizeOf) |
Element |
putIfAbsent(Object key,
Element element,
long sizeOf) |
int |
quickSize()
Returns the number of key-value mappings in this map without locking anything.
|
void |
recalculateSize(Object key) |
Element |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
protected SelectableConcurrentHashMap.Segment |
segmentFor(int hash)
Returns the segment that should be used for key with given hash
|
protected List<SelectableConcurrentHashMap.Segment> |
segments() |
void |
setMaxSize(long maxSize) |
void |
setPinned(Object key,
boolean pinned) |
int |
size() |
Object |
storedObject(Element e)
Return an object of the kind which will be stored when
the element is going to be inserted
|
void |
unpinAll() |
Collection<Element> |
values() |
protected static final Element DUMMY_PINNED_ELEMENT
public SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int concurrency, long maximumSize, RegisteredEventListeners cacheEventNotificationService)
public SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, long maximumSize, RegisteredEventListeners cacheEventNotificationService)
public void setMaxSize(long maxSize)
public Object storedObject(Element e)
e
- the elementpublic int quickSize()
public boolean isEmpty()
public int size()
public int pinnedSize()
public ReentrantReadWriteLock lockFor(Object key)
public ReentrantReadWriteLock[] locks()
public boolean containsKey(Object key)
public boolean containsValue(Object value)
public void clear()
public void unpinAll()
public void setPinned(Object key, boolean pinned)
public boolean isPinned(Object key)
public Collection<Element> values()
protected SelectableConcurrentHashMap.Segment createSegment(int initialCapacity, float lf)
public boolean evict()
public void recalculateSize(Object key)
public Set pinnedKeySet()
protected final SelectableConcurrentHashMap.Segment segmentFor(int hash)
hash
- the hash code for the keyprotected final List<SelectableConcurrentHashMap.Segment> segments()
protected static int hash(int h)
Copyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.