When should I use ConcurrentSkipListMap?

These two classes vary in a few ways. ConcurrentHashMap does not guarantee* the runtime of its operations as part of its contract. It also allows tuning for certain load factors (roughly, the number of threads concurrently modifying it). ConcurrentSkipListMap, on the other hand, guarantees average O(log(n)) performance on a wide variety of operations. It also … Read more

Is gcc std::unordered_map implementation slow? If so – why?

I found the reason: it is a Problem of gcc-4.7!! With gcc-4.7 inserts: 37728 get : 2985 With gcc-4.6 inserts: 2531 get : 1565 So std::unordered_map in gcc-4.7 is broken (or my installation, which is an installation of gcc-4.7.0 on Ubuntu – and another installation which is gcc 4.7.1 on debian testing). I will submit … Read more

Why does ConcurrentHashMap prevent null keys and values?

From the author of ConcurrentHashMap himself (Doug Lea): The main reason that nulls aren’t allowed in ConcurrentMaps (ConcurrentHashMaps, ConcurrentSkipListMaps) is that ambiguities that may be just barely tolerable in non-concurrent maps can’t be accommodated. The main one is that if map.get(key) returns null, you can’t detect whether the key explicitly maps to null vs the … Read more

Is iterating ConcurrentHashMap values thread safe?

What does it mean? That means that each iterator you obtain from a ConcurrentHashMap is designed to be used by a single thread and should not be passed around. This includes the syntactic sugar that the for-each loop provides. What happens if I try to iterate the map with two threads at the same time? … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)