• AbstractOwnableSynchronizer源码


    简介:

    AbstractOwnableSynchronizer主要提供独占式模式下获取临界区访问权限的线程的设置与获取功能并且获取设置方法没有使用任何同步或者volatile关键字的限制

    方法:

     1 public abstract class AbstractOwnableSynchronizer
     2     implements java.io.Serializable {
     3 
     4     /** Use serial ID even though all fields transient. */
     5     private static final long serialVersionUID = 3737899427754241961L;
     6 
     7     /**
     8      * Empty constructor for use by subclasses.
     9      */
    10     protected AbstractOwnableSynchronizer() { }
    11 
    12     /**
    13      * The current owner of exclusive mode synchronization.
    14      */
    15     private transient Thread exclusiveOwnerThread;
    16 
    17     /**
    18      * Sets the thread that currently owns exclusive access.
    19      * A {@code null} argument indicates that no thread owns access.
    20      * This method does not otherwise impose any synchronization or
    21      * {@code volatile} field accesses.
    22      * @param thread the owner thread
    23      */
    24     protected final void setExclusiveOwnerThread(Thread thread) {
    25         exclusiveOwnerThread = thread; 设置获取独占式资源访问权限的线程
    26     }
    27 
    28     /**
    29      * Returns the thread last set by {@code setExclusiveOwnerThread},
    30      * or {@code null} if never set.  This method does not otherwise
    31      * impose any synchronization or {@code volatile} field accesses.
    32      * @return the owner thread
    33      */
    34     protected final Thread getExclusiveOwnerThread() {
    35         return exclusiveOwnerThread;  获取当前获取独占式资源访问权限的线程
    36     }
    37 }


  • 相关阅读:
    python库--pandas--Series.str--字符串处理
    前端--jstree--异步加载数据
    python库--flask--创建嵌套蓝图
    Git--生成公钥和私钥并添加gitlab访问权限
    es查询--请求body
    python生成时间序列(date_range)
    golang使用组合完成伪继承
    golang interface类型的动态绑定
    ruby环境安装草稿
    openfire
  • 原文地址:https://www.cnblogs.com/flydoging/p/13568650.html
Copyright © 2020-2023  润新知