diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/DmxBridgeHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/DmxBridgeHandler.java index 5097e242036..2fba7b72927 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/DmxBridgeHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/DmxBridgeHandler.java @@ -60,7 +60,7 @@ public abstract class DmxBridgeHandler extends BaseBridgeHandler { private boolean isMuted = false; private int refreshTime = 1000 / DEFAULT_REFRESH_RATE; - public DmxBridgeHandler(Bridge dmxBridge) { + protected DmxBridgeHandler(Bridge dmxBridge) { super(dmxBridge); } @@ -148,21 +148,27 @@ public abstract class DmxBridgeHandler extends BaseBridgeHandler { uninstallScheduler(); } if (refreshTime > 0) { - senderJob = scheduler.scheduleAtFixedRate(() -> { - logger.trace("runnable packet sender for universe {} called, state {}/{}", universe.getUniverseId(), - getThing().getStatus(), isMuted); - if (!isMuted) { - sendDmxData(); - } else { - logger.trace("bridge {} is muted", getThing().getUID()); - } - }, 1, refreshTime, TimeUnit.MILLISECONDS); + senderJob = scheduler.scheduleAtFixedRate(this::refresh, 1, refreshTime, TimeUnit.MILLISECONDS); logger.trace("started scheduler for thing {}", this.thing.getUID()); } else { logger.info("refresh disabled for thing {}", this.thing.getUID()); } } + private void refresh() { + try { + logger.trace("runnable packet sender for universe {} called, state {}/{}", universe.getUniverseId(), + getThing().getStatus(), isMuted); + if (!isMuted) { + sendDmxData(); + } else { + logger.trace("bridge {} is muted", getThing().getUID()); + } + } catch (RuntimeException e) { + logger.debug("failed to send DMX data: ", e); + } + } + /** * uninstall the sending and updating scheduler */