Skip to content
Permalink
Browse files

[JENKINS-37566] - FindBugs: Prevent the unconditional wait warning in…

… Channel#waitForProperty()
  • Loading branch information...
oleg-nenashev committed Nov 30, 2017
1 parent 99fec6a commit b50a7812a6f774b76d13020e1e1ef63062aae1bd
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 b50a781

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