- Why use a parallel collection for a synchronized collection?
synchronized - . , synchronized . - a ConcurrentMap.putIfAbsent - compareAndSet, Map .
AtomicInteger AtomicLong ( ) , . :
synchronized (lock) {
int old = counter;
counter++;
return old;
}
:
int old = counter.getAndIncrement();
, , . , , wait boolean. WaitableBoolean Doug Lea concurrency, j.u.c, , .
, Locks . , , ReadWriteLock . , , , . synchronized .
- wait() notify(), notifyAll()?
await, signal signalAll
, , , , , ( ) . , , ( ), .