[Java筆記]Concurrency
- java.util.concurrent.atomic.*
All classes have get and set methods that work like reads and writes on volatile variables.
- ReentrantLock 在進入 wait state 之前, 會暫時 release the lock.
- ReentrantLock有2個contructor
public ReentrantLock()
public ReentrantLock(boolean fair): the longest waiting thread will get the lock next.
- ReentrantLock 可視為一種取代傳統的 "wait-notify" 機制.
- Executor interface:
傾向使用已存在的 worker threads.
- Thread pools:
減少 thread creation 的 overhead.
- Fork/join framework:
An implementation of the ExecutorService interface.
利於使用在 multiple processors 的環境.
- interface ConcurrentHashMap<K, V>
extends AbstractMap<K, V>
implements ConcurrentMap<K, V>, Serializable
- interface ConcurrentMap<K, V>
extends Map<K, V>
沒有留言:
張貼留言