Skip to content

Commit

Permalink
Merge pull request #239 from oleg-nenashev/findbugs-cleanup/JENKINS-3…
Browse files Browse the repository at this point in the history
…7566-uncond-wait-ch-property

[JENKINS-37566] - FindBugs: Prevent the unconditional wait warning in Channel#waitForProperty()
  • Loading branch information
oleg-nenashev committed Nov 30, 2017
2 parents 99fec6a + b50a781 commit bbf5408
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/hudson/remoting/Channel.java
Expand Up @@ -1463,17 +1463,18 @@ public Object waitForProperty(@Nonnull Object key) throws InterruptedException {
throw new IllegalStateException("Channel was already closed", outClosed);

while (true) {
// Now we wait till setProperty() notifies us (in a cycle)
synchronized(this) {
// Now we wait till setProperty() notifies us (in a cycle)
wait(1000);
if (isInClosed()) {
throw new IllegalStateException("Channel was already closed", inClosed);
} else if (isOutClosed()) {
throw new IllegalStateException("Channel was already closed", outClosed);
} else {
wait(1000);
}
}
Object v = properties.get(key);
if (v != null) return v;

if (isInClosed())
throw new IllegalStateException("Channel was already closed", inClosed);
if (isOutClosed())
throw new IllegalStateException("Channel was already closed", outClosed);
}
}

Expand Down

0 comments on commit bbf5408

Please sign in to comment.