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.
*/
// 告诉我们,现在这个同步器,被哪个线程所占有。
// transient 关键字,表明该属性不参与序列化与反序列化。
private transient Thread exclusiveOwnerThread;
/**
* Sets the thread that currently owns exclusive access. A
* <tt>null</tt> argument indicates that no thread owns access.
* This method does not otherwise impose any synchronization or
* <tt>volatile</tt> field accesses.
*/
//设置该同步器的占用线程。
protected final void setExclusiveOwnerThread(Thread t) {
exclusiveOwnerThread = t;
}
/**
* Returns the thread last set by
* <tt>setExclusiveOwnerThread</tt>, or <tt>null</tt> if never
* set. This method does not otherwise impose any synchronization
* or <tt>volatile</tt> field accesses.
* @return the owner thread
*/
//访问该同步器的占用线程
protected final Thread getExclusiveOwnerThread() {
return exclusiveOwnerThread;
}
}