From ee7498a6d17e2ee26d0a0065bbf337223bbe3ac7 Mon Sep 17 00:00:00 2001 From: rschoene <rene.schoene@tu-dresden.de> Date: Tue, 9 Apr 2019 15:21:17 +0200 Subject: [PATCH] Minor fix using the corrent executor. --- .../openlicht/handler/AbstractSmartWatchHandler.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java b/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java index 5fece8d..1369c67 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java @@ -18,7 +18,6 @@ import java.nio.ByteBuffer; import java.nio.DoubleBuffer; import java.util.HashSet; import java.util.Set; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.eclipse.smarthome.core.library.types.DecimalType; @@ -41,8 +40,6 @@ public abstract class AbstractSmartWatchHandler extends AbstractMqttHandler { private static Set<String> seenUnsupportedCategories; - private static ScheduledExecutorService executor; - public AbstractSmartWatchHandler(Thing thing, ConfigurationHolder configurationHolder) { super(thing, configurationHolder); maybeSetupStatics(); @@ -55,7 +52,11 @@ public abstract class AbstractSmartWatchHandler extends AbstractMqttHandler { seenUnsupportedCategories.clear(); } }; - executor.scheduleAtFixedRate(command, 0, timeout, TimeUnit.SECONDS); + if (executor != null) { + executor.scheduleAtFixedRate(command, 0, timeout, TimeUnit.SECONDS); + } else { + logger.warn("Did not schedule reset thread for unsupported categories."); + } } } -- GitLab