< prev index next >
src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java
Print this page
*** 62,78 ****
--- 62,86 ----
* The current owner of exclusive mode synchronization.
*/
private transient Thread exclusiveOwnerThread;
/**
+ * The current or last owner of exclusive mode synchronization.
+ */
+ private transient Thread lastExclusiveOwnerThread;
+
+ /**
* 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) {
+ if (thread != null) {
+ lastExclusiveOwnerThread = thread;
+ }
exclusiveOwnerThread = thread;
}
/**
* Returns the thread last set by {@code setExclusiveOwnerThread},
< prev index next >