mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-14 03:32:06 +01:00
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:
parent
83aa6838d9
commit
cca34fd872
1 changed files with 1 additions and 2 deletions
|
@ -221,12 +221,11 @@ public class SynchronizationPoint<E extends Exception> {
|
||||||
long remainingWait = TimeUnit.MILLISECONDS.toNanos(connection.getPacketReplyTimeout());
|
long remainingWait = TimeUnit.MILLISECONDS.toNanos(connection.getPacketReplyTimeout());
|
||||||
while (state == State.RequestSent || state == State.Initial) {
|
while (state == State.RequestSent || state == State.Initial) {
|
||||||
try {
|
try {
|
||||||
remainingWait = condition.awaitNanos(
|
|
||||||
remainingWait);
|
|
||||||
if (remainingWait <= 0) {
|
if (remainingWait <= 0) {
|
||||||
state = State.NoResponse;
|
state = State.NoResponse;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
remainingWait = condition.awaitNanos(remainingWait);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LOGGER.log(Level.WARNING, "Thread interrupt while waiting for condition or timeout ignored", e);
|
LOGGER.log(Level.WARNING, "Thread interrupt while waiting for condition or timeout ignored", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue