mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +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());
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue