Skip to content
Permalink
Browse files

Merge pull request #239 from oleg-nenashev/findbugs-cleanup/JENKINS-3…

…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 bbf5408f3d2e9d509a362fa4b75fd6a53c5a2495
Showing with 8 additions and 7 deletions.
  1. +8 −7 src/main/java/hudson/remoting/Channel.java
@@ -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);
}
}

0 comments on commit bbf5408

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