[miele] Properly shut down event listener job upon dispose (#9202)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
pull/9213/head
Kai Kreuzer 2020-12-02 18:08:37 +01:00 committed by GitHub
parent 072113f51b
commit 102f770881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -398,7 +398,12 @@ public class MieleBridgeHandler extends BaseBridgeHandler {
listener.onAppliancePropertyChanged(uid, dp);
}
} catch (SocketTimeoutException e) {
Thread.sleep(500);
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
logger.debug("Eventlistener has been interrupted.");
break;
}
}
}
} catch (Exception ex) {
@ -633,5 +638,9 @@ public class MieleBridgeHandler extends BaseBridgeHandler {
pollingJob.cancel(true);
pollingJob = null;
}
if (eventListenerJob != null) {
eventListenerJob.cancel(true);
eventListenerJob = null;
}
}
}