Semaphore source code analysis – java8

1. Characteristic analysis

private final Sync sync; All mechanisms are implemented through the subclass AQS, so the implementation of many methods in this class are delegated to AQS. Abstract static class sync extends the synchronization implementation of abstractqueuedsynchronizer semaphore, which uses AQS status to represent permissions. The subclasses are divided into fair and unfair versions. 2 constructors public semaphore (int permissions) public semaphore (int permissions, Boolean Fair) unfair version of static final class nonfairsync extensions sync fair version of static final class fairsync extensions sync

package sourcecode. analysis;

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>