I've taken some concurrent LRU cache implementation from the web, they have there HashMap and synchronized blocks. What I want is to use ConcurrentHashMap and avoid (where posible) using synchronized blocks. I've put ConcurrentHashMap instead of HashMap and everything went wrong. Thread exits on map.get(key). Maybe my parameters of ConcurrentHashMap need to be customized somehow?
private ConcurrentHashMap<Object, LRUListEntry> map;
protected class LRUListEntry extends Object
{
LRUListEntry next;
LRUListEntry prev;
Object value;
Object key;
int hits;
final int penalty = -1;
public String toString()
{
return key + "=" + value;
}
public Object getKey()
{
return key;
}
public Object getValue()
{
return value;
}
}