diff --git a/bundles/binding/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java b/bundles/binding/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java index 56f642cd265..c7cbc4f5be7 100644 --- a/bundles/binding/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java +++ b/bundles/binding/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java @@ -154,10 +154,20 @@ public synchronized void open() { * Stops communication by disconnecting from the module and stopping all * background tasks. */ - public synchronized void close() { + public void close() { + // first we clear watchdog field in the object + CommunicationWatchdog watchdog = null; if (this.communicationWatchdog != null) { - this.communicationWatchdog.close(); - this.communicationWatchdog = null; + synchronized (this) { + if (this.communicationWatchdog != null) { + watchdog = this.communicationWatchdog; + this.communicationWatchdog = null; + } + } + } + // then, if watchdog exists, we close it + if (watchdog != null) { + watchdog.close(); } }