Files
openide/java/java-impl/resources/inspectionDescriptions/WaitNotifyNotInSynchronizedContext.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

25 lines
790 B
HTML

<html>
<body>
Reports calls to <code>wait()</code>, <code>notify()</code>, and <code>notifyAll()</code>
that are not made inside a corresponding synchronized statement or synchronized method.
<p>
Calling these methods on an object
without holding a lock on that object causes <code>IllegalMonitorStateException</code>.
Such a construct is not necessarily an error, as the necessary lock may be acquired before
the containing method is called, but it's worth looking at.
</p>
<p><b>Example:</b></p>
<pre><code>
class Sync {
private final Object lock = new Object();
void test() throws InterruptedException {
synchronized (this) {
lock.wait(); // 'lock.wait()' is not synchronized on 'lock'
}
}
}
</code></pre>
<!-- tooltip end -->
</body>
</html>