zoukankan      html  css  js  c++  java
  • 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 }


  • 相关阅读:
    百度地图(8)-图层
    百度地图(7)-点聚合
    百度地图(6)-信息窗口
    鸟哥学习笔记二(基础篇第七章)
    鸟哥学习笔记一(基础篇第六章)
    sql server学习笔记二
    sql server学习笔记一
    centos下sudo命令不能使用
    CentOS系统时间与现在时间相差8小时解决方法
    SUID GUID详解
  • 原文地址:https://www.cnblogs.com/flydoging/p/13568650.html
Copyright © 2011-2022 走看看