< prev index next > src/java.base/share/classes/jdk/internal/misc/ThreadFlock.java
Print this page
/**
* Shutdown this flock so that no new threads can be started, existing threads
* in the flock will continue to run. This method is a no-op if the flock is
* already shutdown or closed.
- *
- * <p> This method may only be invoked by the flock owner or threads {@linkplain
- * #containsThread(Thread) contained} in the flock.
- *
- * @throws WrongThreadException if the current thread is not the owner or a thread
- * contained in the flock
*/
public void shutdown() {
- ensureOwnerOrContainsThread();
if (!shutdown) {
shutdown = true;
}
}
* {@linkplain #owner() owner} to return immediately.
*
* <p> If the owner is blocked in {@code awaitAll} then it will return immediately.
* If the owner is not blocked in {@code awaitAll} then its next call to wait
* will return immediately. The method does nothing when the flock is closed.
- *
- * @throws WrongThreadException if the current thread is not the owner or a thread
- * contained in the flock
*/
public void wakeup() {
- ensureOwnerOrContainsThread();
if (!getAndSetPermit(true) && Thread.currentThread() != owner()) {
LockSupport.unpark(owner());
}
}
< prev index next >