org.apache.openjpa.lib.util.concurrent
Class SizedConcurrentHashMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.concurrent.ConcurrentHashMap
org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap
org.apache.openjpa.lib.util.concurrent.SizedConcurrentHashMap
- All Implemented Interfaces:
- Serializable, ConcurrentMap, Map, SizedMap
public class SizedConcurrentHashMap
- extends NullSafeConcurrentHashMap
- implements SizedMap, ConcurrentMap, Serializable
An implementation of SizedMap
that uses JDK1.5 concurrency primitives
- Since:
- 1.1.0
- See Also:
- Serialized Form
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from class org.apache.openjpa.lib.util.concurrent.NullSafeConcurrentHashMap |
contains, containsKey, containsValue, elements, entrySet, get, keys, keySet, randomEntryIterator, remove, remove, removeRandom, replace, replace, values |
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values |
SizedConcurrentHashMap
public SizedConcurrentHashMap(int size,
float load,
int concurrencyLevel)
- Parameters:
size
- the maximum size of this map. If additional elements are
put into the map, overflow will be removed via calls to
overflowRemoved(java.lang.Object, java.lang.Object)
.load
- the load factor for the underlying mapconcurrencyLevel
- the concurrency level for the underlying map- See Also:
ConcurrentHashMap
putIfAbsent
public Object putIfAbsent(Object key,
Object value)
- Specified by:
putIfAbsent
in interface ConcurrentMap
- Overrides:
putIfAbsent
in class NullSafeConcurrentHashMap
put
public Object put(Object key,
Object value)
- Specified by:
put
in interface Map
- Overrides:
put
in class NullSafeConcurrentHashMap
getMaxSize
public int getMaxSize()
- Description copied from interface:
SizedMap
- The maximum number of entries, or Integer.MAX_VALUE for no limit.
- Specified by:
getMaxSize
in interface SizedMap
setMaxSize
public void setMaxSize(int max)
- Description copied from interface:
SizedMap
- The maximum number of entries, or Integer.MAX_VALUE for no limit.
- Specified by:
setMaxSize
in interface SizedMap
removeOverflow
protected void removeOverflow()
- Equivalent to
removeOverflow(false)
.
removeOverflow
protected void removeOverflow(boolean forPut)
- Removes overflow. If
forPut
is true
, then
this uses size() + 1
when computing size.
isFull
public boolean isFull()
- Description copied from interface:
SizedMap
- Whether the map is full.
- Specified by:
isFull
in interface SizedMap
overflowRemoved
public void overflowRemoved(Object key,
Object value)
- This implementation does nothing.
- Specified by:
overflowRemoved
in interface SizedMap
Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.