First check condition, then remaining wait in SynchronizationPoint

as otherwhise SynchronizationPoint may report NoResponseException when
there was in fact a success or failure reported in case there are
multiple threads waiting for the condition.
This commit is contained in:
Florian Schmaus 2015-04-06 21:18:59 +02:00
parent 83aa6838d9
commit cca34fd872
1 changed files with 1 additions and 2 deletions

View File

@ -221,12 +221,11 @@ public class SynchronizationPoint<E extends Exception> {
long remainingWait = TimeUnit.MILLISECONDS.toNanos(connection.getPacketReplyTimeout());
while (state == State.RequestSent || state == State.Initial) {
try {
remainingWait = condition.awaitNanos(
remainingWait);
if (remainingWait <= 0) {
state = State.NoResponse;
break;
}
remainingWait = condition.awaitNanos(remainingWait);
} catch (InterruptedException e) {
LOGGER.log(Level.WARNING, "Thread interrupt while waiting for condition or timeout ignored", e);
}