Skip to content
Permalink
Browse files

[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 48ecfeed7919213046f59953c383402e87ad930f
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/hudson/remoting/Channel.java
@@ -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;

0 comments on commit 48ecfee

Please sign in to comment.
You can’t perform that action at this time.