mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-09 06:31:08 +01:00
Improve handling of InterruptedException
InterruptedExceptions should be treated as the users intention to 'cancel' the current thread's task. There is no such thing as a spurious interrupt (not to be confused with "spurious wakeups").
This commit is contained in:
parent
14b03149db
commit
d099e7b16d
5 changed files with 15 additions and 11 deletions
|
|
@ -156,13 +156,15 @@ public class ReconnectionManager {
|
|||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
// We don't need to handle spurious interrupts, in the worst case, this will cause to
|
||||
// reconnect a few seconds earlier, depending on how many (spurious) interrupts arrive while
|
||||
// sleep() is called.
|
||||
LOGGER.log(Level.FINE, "Supurious interrupt", e);
|
||||
LOGGER.log(Level.FINE, "waiting for reconnection interrupted", e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (ConnectionListener listener : connection.connectionListeners) {
|
||||
listener.reconnectingIn(0);
|
||||
}
|
||||
|
||||
// Makes a reconnection attempt
|
||||
try {
|
||||
if (isReconnectionPossible(connection)) {
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ public class Roster {
|
|||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
LOGGER.log(Level.FINE, "spurious interrupt", e);
|
||||
LOGGER.log(Level.FINE, "interrupted", e);
|
||||
break;
|
||||
}
|
||||
long now = System.currentTimeMillis();
|
||||
waitTime -= now - start;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue