AQS的源码分析

1.AQS源码分析

        从整体的aqs实现锁的流程上分析源码

2.

AQS的继承图

AbstractOwnableSynchronizer的代码

、、、

public abstract class AbstractOwnableSynchronizer

implements java.io.Serializable {

/** Use serial ID even though all fields transient. */

    private static final long serialVersionUID =3737899427754241961L;

/**

* Empty constructor for use by subclasses.

*/

    protected AbstractOwnableSynchronizer() { }

/**

* The current owner of exclusive mode synchronization.

*/

    private transient ThreadexclusiveOwnerThread;

/**

* Sets the thread that currently owns exclusive access.

    * A {@code null} argument indicates that no thread owns access.

* This method does not otherwise impose any synchronization or

    * {@code volatile} field accesses.

    * @param thread the owner thread

*/

    protected final void setExclusiveOwnerThread(Thread thread) {

exclusiveOwnerThread = thread;

}

/**

    * Returns the thread last set by {@code setExclusiveOwnerThread},

    * or {@code null} if never set.  This method does not otherwise

    * impose any synchronization or {@code volatile} field accesses.

    * @return the owner thread

*/

    protected final Thread getExclusiveOwnerThread() {

return exclusiveOwnerThread;

}

}

、、、

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容