Similar to 3 locks under JUC in a distributed situation

Semaphore -> can also be used for distributed current limiting

Calling acquire here does not account for the waiting time.
You can call tryAcquire and return false if it does not account for it.
Insert picture description here

CountDownLatch

We will unlock only when the set number is gone
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_36905956/article/details/112163489