Exclude concurrent activity from a parallel Java collection

Joshua Bloch Effective Java, Second Edition, paragraph 69, states that

[...] To provide high concurrency, these implementations themselves manage their own synchronization (clause 67). Therefore, simultaneous activity cannot be excluded from parallel collection; blocking will have no effect , but to slow down the program.

Is this last statement correct? If two threads block collection and perform several operations inside this lock, can these operations still alternate?

If the statement is correct, I would expect that either these collections will execute threads inside with which you cannot synchronize, or somehow "redefine" the standard synchronization behavior, so that the type operator synchronized(map){ ... }behaves differently than on the "normal" object . From the answers / comments to related questions, I don't think if this is so:

To avoid possible misinterpretation:

  • I know that parallel collections are designed specifically to avoid this global blocking, my question is whether this is possible in principle
  • I find effective Java to be a great book, and I'm just looking for clarity regarding a particular element.
+4
2

, ConcurrentHashMap (static final class [More ...] Segment<K,V> extends ReentrantLock) - synchronized .

Map synchronize - new Object() ReentrantLock. Map, , , - , .

+2

( 67):

, , .

. ( ), .

0

All Articles