Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-37566] - Channel#waitForProperty() should use wait() with a …
…timeout.

In the worst case it will cause looping within the loop, but it should be fine in the case of the current implementation.
It also prevents the infinite lock when the channel cloases and does not send notifyAll() properly.
  • Loading branch information
oleg-nenashev committed Nov 20, 2017
1 parent 2d5624c commit 48ecfee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/hudson/remoting/Channel.java
Expand Up @@ -1465,8 +1465,8 @@ public Object waitForProperty(@Nonnull Object key) throws InterruptedException {

while (true) {
synchronized(this) {
// Now we wait till setProperty() notifies us
wait();
// Now we wait till setProperty() notifies us (in a cycle)
wait(1000);
}
Object v = properties.get(key);
if (v != null) return v;
Expand Down

0 comments on commit 48ecfee

Please sign in to comment.