Semaphore
Semaphore
A counting semaphore.Conceptually, a semaphore maintains a set of permits.
- Each {@link #acquire} blocks if necessary until a permit is available, and then takes it.
- Each {@link #release} adds a permit, potentially releasing a blocking acquirer.
ReentrantLock
ReentrantLock
可重入锁,独占模式exclusive,Fair/UnFair
A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor lock accessed using synchronized methods and statements, but with extended capabilities.
Review

《庄子.人间世》
孔子适楚①,楚狂接舆游其门曰②:“凤兮凤兮③,何如德之衰也④!来世不可待,往世不可追也。 天下有道⑤,圣人成焉⑥;天下无道,圣人生焉。 方今之时,仅免刑焉。福轻乎羽⑦,莫之知载⑧;祸重乎地,莫之知避。 已乎已乎⑨。临人以德!殆乎殆乎,画地而趋⑩!迷阳迷阳(11),无伤吾行!吾行郤曲(12),无伤吾足。”
山木自寇也(13),膏火自煎也(14)。桂可食(15),故伐之;漆可用,故割之。人皆知有用之用,而莫知无用之用也。
ConcurrentHashMap代码分析
ConcurrentHashMap
源码分析
1 | public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> |

