From d63dc6219285f56d79beb0c600b39f79e8a3fd78 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Mon, 25 Nov 2024 21:07:05 +0100 Subject: [PATCH 01/22] Fix thread names Signed-off-by: Leo Siepel --- .../protocol/googletv/GoogleTVConnectionManager.java | 12 ++++++++---- .../protocol/shieldtv/ShieldTVConnectionManager.java | 10 ++++++---- .../anthem/internal/handler/AnthemHandler.java | 4 ++-- .../device/passthrough/RemoteArgoApiServerStub.java | 2 +- .../internal/EchonetLiteBridgeHandler.java | 4 +--- .../ekey/internal/api/EkeyUdpPacketReceiver.java | 4 ++-- .../binding/ekey/internal/handler/EkeyHandler.java | 3 +-- .../binding/hue/internal/connection/Clip2Bridge.java | 4 +++- .../insteon/internal/transport/LegacyPort.java | 4 ++-- .../intesis/internal/api/IntesisBoxSocketApi.java | 4 ++-- .../intesis/internal/handler/IntesisBoxHandler.java | 5 +---- .../keba/internal/handler/KeContactTransceiver.java | 4 +++- .../loxone/internal/security/LxWsSecurity.java | 2 +- .../lutron/internal/handler/IPBridgeHandler.java | 2 +- .../lutron/internal/handler/LeapBridgeHandler.java | 4 ++-- .../luxom/internal/handler/LuxomBridgeHandler.java | 2 +- .../max/internal/handler/MaxCubeBridgeHandler.java | 3 ++- .../binding/mihome/internal/socket/XiaomiSocket.java | 2 +- .../internal/protocol/MilightV6SessionManager.java | 3 ++- .../milight/internal/protocol/QueuedSend.java | 2 +- .../milight/internal/test/EmulatedV6Bridge.java | 6 +++--- .../internal/handler/PentairBaseBridgeHandler.java | 2 +- .../russound/internal/net/SocketChannelSession.java | 8 ++++++-- .../binding/satel/internal/protocol/SatelModule.java | 2 +- .../internal/manager/ShellyManagerActionPage.java | 8 ++++---- .../internal/manager/ShellyManagerOtaPage.java | 2 +- .../handler/SilvercrestWifiSocketMediatorImpl.java | 3 ++- .../internal/core/TelldusCoreBridgeHandler.java | 3 ++- .../internal/core/TelldusCoreDeviceController.java | 4 ++-- .../internal/handler/VitotronicBridgeHandler.java | 3 +-- .../lib/device/connection/WifiConnection.java | 3 ++- .../internal/lib/services/DeviceManager.java | 3 ++- 32 files changed, 70 insertions(+), 57 deletions(-) diff --git a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConnectionManager.java b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConnectionManager.java index 1ba30cb807472..0724f3f95fa33 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConnectionManager.java +++ b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/googletv/GoogleTVConnectionManager.java @@ -579,7 +579,8 @@ public void connect() { logger.trace("{} - Starting Reader Thread for {}:{}", handler.getThingID(), config.ipAddress, config.googletvPort); - Thread readerThread = new Thread(this::readerThreadJob, "GoogleTV reader " + handler.getThingID()); + Thread readerThread = new Thread(this::readerThreadJob, + "OH-binding-" + handler.getThingUID() + "-GoogleTVReader"); readerThread.setDaemon(true); readerThread.start(); this.readerThread = readerThread; @@ -587,7 +588,8 @@ public void connect() { logger.trace("{} - Starting Sender Thread for {}:{}", handler.getThingID(), config.ipAddress, config.googletvPort); - Thread senderThread = new Thread(this::senderThreadJob, "GoogleTV sender " + handler.getThingID()); + Thread senderThread = new Thread(this::senderThreadJob, + "OH-binding-" + handler.getThingUID() + "-GoogleTVSender"); senderThread.setDaemon(true); senderThread.start(); this.senderThread = senderThread; @@ -698,12 +700,14 @@ public void shimInitialize() { this.shimServerSocket = serverSocket; this.shimQueue.clear(); - Thread readerThread = new Thread(this::shimReaderThreadJob, "GoogleTV shim reader"); + Thread readerThread = new Thread(this::shimReaderThreadJob, + "OH-binding-" + handler.getThingUID() + "-GoogleTVShimReader"); readerThread.setDaemon(true); readerThread.start(); this.shimReaderThread = readerThread; - Thread senderThread = new Thread(this::shimSenderThreadJob, "GoogleTV shim sender"); + Thread senderThread = new Thread(this::shimSenderThreadJob, + "OH-binding-" + handler.getThingUID() + "-GoogleTVShimSender"); senderThread.setDaemon(true); senderThread.start(); this.shimSenderThread = senderThread; diff --git a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/shieldtv/ShieldTVConnectionManager.java b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/shieldtv/ShieldTVConnectionManager.java index 0c79a8f04c558..bf6f173a2801e 100644 --- a/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/shieldtv/ShieldTVConnectionManager.java +++ b/bundles/org.openhab.binding.androidtv/src/main/java/org/openhab/binding/androidtv/internal/protocol/shieldtv/ShieldTVConnectionManager.java @@ -443,12 +443,14 @@ public void connect() { setStatus(false, "offline.initializing"); - Thread readerThread = new Thread(this::readerThreadJob, "ShieldTV reader " + handler.getThingID()); + Thread readerThread = new Thread(this::readerThreadJob, + "OH-binding-" + handler.getThingUID() + "-ShieldTVReader"); readerThread.setDaemon(true); readerThread.start(); this.readerThread = readerThread; - Thread senderThread = new Thread(this::senderThreadJob, "ShieldTV sender " + handler.getThingID()); + Thread senderThread = new Thread(this::senderThreadJob, + "OH-binding-" + handler.getThingUID() + "-ShieldTVSender"); senderThread.setDaemon(true); senderThread.start(); this.senderThread = senderThread; @@ -513,13 +515,13 @@ public void shimInitialize() { this.shimServerSocket = serverSocket; Thread readerThread = new Thread(this::shimReaderThreadJob, - "ShieldTV shim reader " + handler.getThingID()); + "OH-binding-" + handler.getThingUID() + "-ShieldTVShimReader"); readerThread.setDaemon(true); readerThread.start(); this.shimReaderThread = readerThread; Thread senderThread = new Thread(this::shimSenderThreadJob, - "ShieldTV shim sender" + handler.getThingID()); + "OH-binding-" + handler.getThingUID() + "-ShieldTVShimSender"); senderThread.setDaemon(true); senderThread.start(); this.shimSenderThread = senderThread; diff --git a/bundles/org.openhab.binding.anthem/src/main/java/org/openhab/binding/anthem/internal/handler/AnthemHandler.java b/bundles/org.openhab.binding.anthem/src/main/java/org/openhab/binding/anthem/internal/handler/AnthemHandler.java index 4ea2e505322bd..24445dc02590a 100644 --- a/bundles/org.openhab.binding.anthem/src/main/java/org/openhab/binding/anthem/internal/handler/AnthemHandler.java +++ b/bundles/org.openhab.binding.anthem/src/main/java/org/openhab/binding/anthem/internal/handler/AnthemHandler.java @@ -242,12 +242,12 @@ private synchronized void connect() { scheduleConnectRetry(reconnectIntervalMinutes); return; } - Thread localReaderThread = new Thread(this::readerThreadJob, "Anthem reader"); + Thread localReaderThread = new Thread(this::readerThreadJob, "OH-binding-" + getThing().getUID() + "-Reader"); localReaderThread.setDaemon(true); localReaderThread.start(); this.readerThread = localReaderThread; - Thread localSenderThread = new Thread(this::senderThreadJob, "Anthem sender"); + Thread localSenderThread = new Thread(this::senderThreadJob, "OH-binding-" + getThing().getUID() + "-Sender"); localSenderThread.setDaemon(true); localSenderThread.start(); this.senderThread = localSenderThread; diff --git a/bundles/org.openhab.binding.argoclima/src/main/java/org/openhab/binding/argoclima/internal/device/passthrough/RemoteArgoApiServerStub.java b/bundles/org.openhab.binding.argoclima/src/main/java/org/openhab/binding/argoclima/internal/device/passthrough/RemoteArgoApiServerStub.java index ce3adcbd489fd..64dd206e9aa6e 100644 --- a/bundles/org.openhab.binding.argoclima/src/main/java/org/openhab/binding/argoclima/internal/device/passthrough/RemoteArgoApiServerStub.java +++ b/bundles/org.openhab.binding.argoclima/src/main/java/org/openhab/binding/argoclima/internal/device/passthrough/RemoteArgoApiServerStub.java @@ -290,7 +290,7 @@ public synchronized void start() throws ArgoRemoteServerStubStartupException { // to stop, actually) s.setStopTimeout(1000L); try { - new Thread() { + new Thread("OH-binding-" + this.id + "-APIStub") { @Override public void run() { try { diff --git a/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java b/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java index 078e0cf7bb4c6..89a6611705a24 100644 --- a/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java +++ b/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java @@ -52,7 +52,7 @@ public class EchonetLiteBridgeHandler extends BaseBridgeHandler { private final ArrayBlockingQueue requests = new ArrayBlockingQueue<>(1024); private final Map devicesByKey = new HashMap<>(); private final EchonetMessageBuilder messageBuilder = new EchonetMessageBuilder(); - private final Thread networkingThread = new Thread(this::poll); + private final Thread networkingThread = new Thread(this::poll, "OH-binding-" + EchonetLiteBindingConstants.BINDING_ID); private final EchonetMessage echonetMessage = new EchonetMessage(); private final MonotonicClock clock = new MonotonicClock(); @@ -76,8 +76,6 @@ private void start(final InstanceKey managementControllerKey, InstanceKey discov logger.debug("Binding echonet channel"); echonetChannel = new EchonetChannel(discoveryKey.address); logger.debug("Starting networking thread"); - - networkingThread.setName("OH-binding-" + EchonetLiteBindingConstants.BINDING_ID); networkingThread.setDaemon(true); networkingThread.start(); } diff --git a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java index 8648ca2eb5c13..cf58c3d5876ff 100644 --- a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java +++ b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java @@ -48,10 +48,10 @@ public class EkeyUdpPacketReceiver { private boolean connected = false; - public EkeyUdpPacketReceiver(final String ipAddress, final int port, final String readerThreadName) { + public EkeyUdpPacketReceiver(final String ipAddress, final int port, final String thingUID) { this.ipAddress = ipAddress; this.port = port; - this.readerThreadName = readerThreadName; + this.readerThreadName = "OH-binding-" + thingUID; } public void openConnection() throws IOException { diff --git a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java index cc9b3cbe369b1..2b9825781e331 100644 --- a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java +++ b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java @@ -82,10 +82,9 @@ public void initialize() { scheduler.submit(() -> { populateChannels(config.protocol); - String readerThreadName = "OH-binding-" + getThing().getUID().getAsString(); EkeyUdpPacketReceiver localReceiver = receiver = new EkeyUdpPacketReceiver( - Objects.requireNonNullElse(config.natIp, config.ipAddress), config.port, readerThreadName); + Objects.requireNonNullElse(config.natIp, config.ipAddress), config.port, getThing().getUID().getAsString()); localReceiver.addEkeyPacketListener(this); try { localReceiver.openConnection(); diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java index 59cd410a22b47..5799c8b9bc58c 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java @@ -70,6 +70,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Promise.Completable; import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.openhab.binding.hue.internal.HueBindingConstants; import org.openhab.binding.hue.internal.api.dto.clip1.CreateUserRequest; import org.openhab.binding.hue.internal.api.dto.clip1.SuccessResponse; import org.openhab.binding.hue.internal.api.dto.clip2.BridgeConfig; @@ -397,7 +398,8 @@ public void onFailure(@Nullable Session session, @Nullable Throwable failure) { public void onGoAway(@Nullable Session session, @Nullable GoAwayFrame frame) { Objects.requireNonNull(session); if (session.equals(http2Session)) { - Thread recreateThread = new Thread(() -> recreateSession()); + Thread recreateThread = new Thread(() -> recreateSession(), + "OH-binding-" + HueBindingConstants.BINDING_ID + "-Clip2Bridge"); Clip2Bridge.this.recreateThread = recreateThread; recreateThread.start(); } diff --git a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java index 664a1f8386938..7f9263534f8c4 100644 --- a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java +++ b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java @@ -178,9 +178,9 @@ public void start() { } readThread = new Thread(reader); - setParamsAndStart(readThread, "Reader"); + setParamsAndStart(readThread, "OH-binding-" + InsteonBindingConstants.BINDING_ID + "-LegacyReader"); writeThread = new Thread(writer); - setParamsAndStart(writeThread, "Writer"); + setParamsAndStart(writeThread, "OH-binding-" + InsteonBindingConstants.BINDING_ID + "-LegacyWriter"); if (!mdbb.isComplete()) { modem.initialize(); diff --git a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java index 55c249ba37567..a144b43a1748b 100644 --- a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java +++ b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java @@ -52,10 +52,10 @@ public class IntesisBoxSocketApi { private boolean connected = false; - public IntesisBoxSocketApi(final String ipAddress, final int port, final String readerThreadName) { + public IntesisBoxSocketApi(final String ipAddress, final int port, final String thingUID) { this.ipAddress = ipAddress; this.port = port; - this.readerThreadName = readerThreadName; + this.readerThreadName = "OH-binding-" + thingUID; } private class IntesisSocket { diff --git a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java index 5a82a2e231899..db98feb252099 100644 --- a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java +++ b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java @@ -93,11 +93,8 @@ public void initialize() { if (!config.ipAddress.isEmpty()) { updateStatus(ThingStatus.UNKNOWN); scheduler.submit(() -> { - - String readerThreadName = "OH-binding-" + getThing().getUID().getAsString(); - IntesisBoxSocketApi intesisLocalApi = intesisBoxSocketApi = new IntesisBoxSocketApi(config.ipAddress, - config.port, readerThreadName); + config.port, getThing().getUID().getAsString()); intesisLocalApi.addIntesisBoxChangeListener(this); try { intesisLocalApi.openConnection(); diff --git a/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactTransceiver.java b/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactTransceiver.java index 2e2d4503d6814..315009c78d265 100644 --- a/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactTransceiver.java +++ b/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactTransceiver.java @@ -32,6 +32,7 @@ import java.util.Set; import java.util.concurrent.locks.ReentrantLock; +import org.openhab.binding.keba.internal.KebaBindingConstants; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatusDetail; import org.slf4j.Logger; @@ -71,7 +72,8 @@ public void start() { selector = Selector.open(); if (transceiverThread == null) { - transceiverThread = new Thread(transceiverRunnable, "OH-binding-Keba-Transceiver"); + transceiverThread = new Thread(transceiverRunnable, + "OH-binding-" + KebaBindingConstants.BINDING_ID + "-Transceiver"); transceiverThread.start(); } diff --git a/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java b/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java index e9f0d155f85fb..aef2134003b0b 100644 --- a/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java +++ b/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java @@ -86,7 +86,7 @@ public void authenticate(BiConsumer doneCallback) { authenticationLock.unlock(); } }; - new Thread(init).start(); + new Thread(init, "OH-binding-" + thingHandler.getThingUID() + "-Authenticate").start(); } /** diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java index 9ea61279430a2..ff64341b498ea 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java @@ -216,7 +216,7 @@ private synchronized void connect() { sendCommand(new LIPCommand(TargetType.BRIDGE, LutronOperation.QUERY, LutronCommandType.SYSTEM, null, SYSTEM_DBEXPORTDATETIME)); - messageSender = new Thread(this::sendCommandsThread, "Lutron sender"); + messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getBridgeUID() + "-IPBridgeSender"); messageSender.start(); logger.debug("Starting keepAlive job with interval {}", heartbeatInterval); diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java index 0bd9a24760cb8..83761b4213228 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java @@ -304,12 +304,12 @@ private synchronized void connect() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, STATUS_INITIALIZING); - Thread readerThread = new Thread(this::readerThreadJob, "Lutron reader"); + Thread readerThread = new Thread(this::readerThreadJob, "OH-binding-" + getBridgeUID() + "-BridgeReader"); readerThread.setDaemon(true); readerThread.start(); this.readerThread = readerThread; - Thread senderThread = new Thread(this::senderThreadJob, "Lutron sender"); + Thread senderThread = new Thread(this::senderThreadJob, "OH-binding-" + getBridgeUID() + "-BridgeSender"); senderThread.setDaemon(true); senderThread.start(); this.senderThread = senderThread; diff --git a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java index 0072b7d578376..19137dde5adcf 100644 --- a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java +++ b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java @@ -139,7 +139,7 @@ public void startProcessing() { updateStatus(ThingStatus.ONLINE); - messageSender = new Thread(this::sendCommandsThread, "Luxom sender"); + messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getBridgeUID() + "-Sender"); messageSender.start(); logger.debug("Starting heartbeat job with interval {} (seconds)", HEARTBEAT_INTERVAL_SECONDS); diff --git a/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java b/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java index ea8f42a33087b..bf45390d303a7 100644 --- a/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java +++ b/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java @@ -340,7 +340,8 @@ private synchronized void startAutomaticRefresh() { pollingJob = scheduler.scheduleWithFixedDelay(this::refreshData, 0, refreshInterval, TimeUnit.SECONDS); } if (queueConsumerThread == null || !queueConsumerThread.isAlive()) { - queueConsumerThread = new Thread(new QueueConsumer(commandQueue), "max-queue-consumer"); + queueConsumerThread = new Thread(new QueueConsumer(commandQueue), + "OH-binding-" + getBridge().getBridgeUID() + "-max-queue-consumer"); queueConsumerThread.setDaemon(true); queueConsumerThread.start(); } diff --git a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java index 1119057d5bd0d..bbb8b3a3848ef 100644 --- a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java +++ b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java @@ -71,7 +71,7 @@ public XiaomiSocket(String owner) { */ public XiaomiSocket(int port, String owner) { this.port = port; - socketReceiveThread.setName("XiaomiSocketReceiveThread(" + port + ", " + owner + ")"); + socketReceiveThread.setName("OH-binding-" + this.getThing().getUID() + "-XiaomiSocket(" + port + ", " + owner + ")"); } public void initialize() { diff --git a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/MilightV6SessionManager.java b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/MilightV6SessionManager.java index 0d04f8bc4c879..8713451fba7e7 100644 --- a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/MilightV6SessionManager.java +++ b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/MilightV6SessionManager.java @@ -32,6 +32,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.milight.internal.MilightBindingConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -185,7 +186,7 @@ public MilightV6SessionManager(String bridgeId, ISessionState observer, @Nullabl throw new IllegalArgumentException("keepAliveInterval not within given limits!"); } - sessionThread = new Thread(this, "SessionThread"); + sessionThread = new Thread(this, "OH-binding-" + MilightBindingConstants.BINDING_ID + "-SessionThread"); } /** diff --git a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java index 8666591e45d92..61acb63144cbe 100644 --- a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java +++ b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java @@ -48,7 +48,7 @@ public class QueuedSend implements Runnable, Closeable { */ public void start() { willbeclosed = false; - thread = new Thread(this); + thread = new Thread(this, "OH-binding-" + MilightBindingConstants.BINDING_ID + "-QueueSend"); thread.start(); } diff --git a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java index 243a912d726c1..bdbf8ccbcb800 100644 --- a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java +++ b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java @@ -92,8 +92,8 @@ public class EmulatedV6Bridge { FAKE_MAC[2], FAKE_MAC[3], FAKE_MAC[4], FAKE_MAC[5], 1 }; EmulatedV6Bridge() { - new Thread(this::runDiscovery).start(); - new Thread(this::runBrigde).start(); + new Thread(this::runDiscovery,"OH-binding-" + MilightBindingConstants.BINDING_ID + "-runDiscovery").start(); + new Thread(this::runBridge,"OH-binding-" + MilightBindingConstants.BINDING_ID + "-runBridge").start(); } private void replaceWithMac(byte[] data, int offset) { @@ -144,7 +144,7 @@ public void runDiscovery() { } } - public void runBrigde() { + public void runBridge() { try { byte[] a = new byte[0]; DatagramPacket sPacket = new DatagramPacket(a, a.length); diff --git a/bundles/org.openhab.binding.pentair/src/main/java/org/openhab/binding/pentair/internal/handler/PentairBaseBridgeHandler.java b/bundles/org.openhab.binding.pentair/src/main/java/org/openhab/binding/pentair/internal/handler/PentairBaseBridgeHandler.java index 65c0107a37a07..f0c17584ec84b 100644 --- a/bundles/org.openhab.binding.pentair/src/main/java/org/openhab/binding/pentair/internal/handler/PentairBaseBridgeHandler.java +++ b/bundles/org.openhab.binding.pentair/src/main/java/org/openhab/binding/pentair/internal/handler/PentairBaseBridgeHandler.java @@ -203,7 +203,7 @@ private void baseConnect() { return; } - Thread parserThread = new Thread(parser, "OH-pentair-" + this.getThing().getUID() + "-parser"); + Thread parserThread = new Thread(parser, "OH-binding-" + this.getThing().getUID() + "-parser"); this.parserThread = parserThread; parserThread.setDaemon(true); diff --git a/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java b/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java index 4f1c7bed490b3..421475656f4f7 100644 --- a/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java +++ b/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java @@ -24,6 +24,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import org.openhab.binding.lutron.internal.grxprg.SocketSession; +import org.openhab.binding.russound.internal.RussoundBindingConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -127,8 +129,10 @@ public void connect(int timeout) throws IOException { responses.clear(); - dispatchingThread = new Thread(new Dispatcher()); - responseThread = new Thread(new ResponseReader()); + dispatchingThread = new Thread(new Dispatcher(), + "OH-binding-" + RussoundBindingConstants.BINDING_ID + "-dispatcher"); + responseThread = new Thread(new ResponseReader(), + "OH-binding-" + RussoundBindingConstants.BINDING_ID + "-responseReader"); dispatchingThread.start(); responseThread.start(); diff --git a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java index 502ce80cb0903..9d17bb1c4df98 100644 --- a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java +++ b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java @@ -520,7 +520,7 @@ public void run() { SatelModule.this.communicationLoop(CommunicationWatchdog.this); logger.debug("Communication thread stopped"); } - }); + }, "OH-binding-" + SatelBindingConstants.BINDING_ID + "-dispatcher"); thread.start(); this.thread = thread; // if module is not initialized yet, send version command diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java index 1b6d8e0cb2f9a..fa17d22bb0e08 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java @@ -103,7 +103,7 @@ public ShellyMgrResponse generateContent(String path, Map para // maybe the device restarts before returning the http response } setRestarted(th, uid); // refresh after reboot - }).start(); + }, "OH-binding-" + ShellyBindingConstants.BINDING_ID + "-" + uid + "-deviceReboot").start(); refreshTimer = profile.isMotion ? 60 : 30; } else { message = getMessageS("action.restart.confirm", MCINFO); @@ -162,7 +162,7 @@ public ShellyMgrResponse generateContent(String path, Map para // maybe the device restarts before returning the http response } setRestarted(th, uid); // refresh after reboot - }).start(); + }, "OH-binding-" + ShellyBindingConstants.BINDING_ID + "-" + uid + "-reboot").start(); // The device needs a restart after changing the peer mode message = getMessageP("action.restart.info", MCINFO); @@ -188,7 +188,7 @@ public ShellyMgrResponse generateContent(String path, Map para } catch (ShellyApiException e) { // maybe the device restarts before returning the http response } - }).start(); + }, "OH-binding-" + ShellyBindingConstants.BINDING_ID + "-" + uid + "-factoryReset").start(); message = getMessageP("action.reset.confirm", MCINFO, serviceName); refreshTimer = 5; } @@ -216,7 +216,7 @@ public ShellyMgrResponse generateContent(String path, Map para } catch (ShellyApiException e) { // maybe the device restarts before returning the http response } - }).start(); + }, "OH-binding-" + ShellyBindingConstants.BINDING_ID + "-" + uid + "-setDebug").start(); message = getMessage("action.debug-confirm", enable ? "enabled" : "disabled"); refreshTimer = 3; diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java index eb759411a5f60..92d91ea663d5b 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java @@ -134,7 +134,7 @@ public ShellyMgrResponse generatePage(String path, Map paramet // maybe the device restarts before returning the http response logger.warn("{}: {}", th.getThingName(), getMessage("fwupdate.initiated", e.toString())); } - }).start(); + }, "OH-binding-" + ShellyBindingConstants.BINDING_ID + "-" + uid + "-scheduleUpdate").start(); } else { String message = getMessageP("fwupdate.confirm", MCINFO); properties.put(ATTRIBUTE_MESSAGE, message); diff --git a/bundles/org.openhab.binding.silvercrestwifisocket/src/main/java/org/openhab/binding/silvercrestwifisocket/internal/handler/SilvercrestWifiSocketMediatorImpl.java b/bundles/org.openhab.binding.silvercrestwifisocket/src/main/java/org/openhab/binding/silvercrestwifisocket/internal/handler/SilvercrestWifiSocketMediatorImpl.java index d472895cb6602..94b0dc92e8427 100644 --- a/bundles/org.openhab.binding.silvercrestwifisocket/src/main/java/org/openhab/binding/silvercrestwifisocket/internal/handler/SilvercrestWifiSocketMediatorImpl.java +++ b/bundles/org.openhab.binding.silvercrestwifisocket/src/main/java/org/openhab/binding/silvercrestwifisocket/internal/handler/SilvercrestWifiSocketMediatorImpl.java @@ -145,7 +145,8 @@ private void initMediatorWifiSocketUpdateReceiverRunnable() { try { this.receiver = new SilvercrestWifiSocketUpdateReceiverRunnable(this, SilvercrestWifiSocketBindingConstants.WIFI_SOCKET_DEFAULT_UDP_PORT); - this.receiverThread = new Thread(this.receiver); + this.receiverThread = new Thread(this.receiver, + "OH-binding-" + SilvercrestWifiSocketBindingConstants.BINDING_ID + "-receiver"); this.receiverThread.start(); logger.debug("Invoked the start of receiver thread."); } catch (SocketException e) { diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java index f5b90334de079..8b1387bd1bd28 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java @@ -129,7 +129,8 @@ public void initialize() { } private void setupDeviceController(TellstickBridgeConfiguration configuration) { - deviceController = new TelldusCoreDeviceController(configuration.resendInterval); + deviceController = new TelldusCoreDeviceController(configuration.resendInterval, + getBridge().getUID().getAsString()); eventHandler.addListener((TelldusCoreDeviceController) deviceController); } diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java index ecff75e061d9b..de04ab76838e3 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java @@ -55,11 +55,11 @@ public class TelldusCoreDeviceController implements DeviceChangeListener, Sensor private Thread workerThread; private SortedMap messageQue; - public TelldusCoreDeviceController(long resendInterval) { + public TelldusCoreDeviceController(long resendInterval, String thingUID) { this.resendInterval = resendInterval; messageQue = Collections.synchronizedSortedMap(new TreeMap<>()); telldusCoreWorker = new TelldusCoreWorker(messageQue); - workerThread = new Thread(telldusCoreWorker); + workerThread = new Thread(telldusCoreWorker, "OH-binding-" + thingUID + "-worker"); } @Override diff --git a/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java b/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java index 27536b376a6ea..ba774c8b7176d 100644 --- a/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java +++ b/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java @@ -276,8 +276,7 @@ private void startSocketReceiver() { if (!isConnect) { openSocket(); - Thread thread = new Thread(socketReceiverRunnable); - thread.setName("VitotronicSocketThread"); + Thread thread = new Thread(socketReceiverRunnable, "OH-binding-" + getBridge().getUID() + "-SocketThread"); thread.start(); } } diff --git a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java index 678b9153c22ba..96fae82561455 100644 --- a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java +++ b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java @@ -17,6 +17,7 @@ import java.io.InputStreamReader; import java.net.Socket; +import org.openhab.binding.yeelight.internal.YeelightBindingConstants; import org.openhab.binding.yeelight.internal.lib.device.ConnectState; import org.openhab.binding.yeelight.internal.lib.device.DeviceBase; import org.openhab.binding.yeelight.internal.lib.device.DeviceMethod; @@ -120,7 +121,7 @@ public boolean connect() { mDevice.setConnectionState(ConnectState.DISCONNECTED); mSocket = null; } - }); + }, "OH-binding-" + YeelightBindingConstants.BINDING_ID + "-WIFIConnection"); mConnectThread.start(); return false; } diff --git a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java index 652e8e4bd6c49..e6a4ae55a4897 100644 --- a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java +++ b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java @@ -29,6 +29,7 @@ import java.util.concurrent.Executors; import java.util.stream.Collectors; +import org.openhab.binding.yeelight.internal.YeelightBindingConstants; import org.openhab.binding.yeelight.internal.lib.device.DeviceBase; import org.openhab.binding.yeelight.internal.lib.device.DeviceFactory; import org.openhab.binding.yeelight.internal.lib.device.DeviceStatus; @@ -98,7 +99,7 @@ public void startDiscovery(long timeToStop) { } finally { stopDiscovery(); } - }).start(); + }, "OH-binding-" + YeelightBindingConstants.BINDING_ID + "-DeviceManager").start(); } } From f7d58a52e75cf9976b9d1fdda794a8e33dc4f662 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Mon, 25 Nov 2024 21:45:59 +0100 Subject: [PATCH 02/22] Spotless Signed-off-by: Leo Siepel --- .../binding/echonetlite/internal/EchonetLiteBridgeHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java b/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java index 89a6611705a24..11bc6334dc7fe 100644 --- a/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java +++ b/bundles/org.openhab.binding.echonetlite/src/main/java/org/openhab/binding/echonetlite/internal/EchonetLiteBridgeHandler.java @@ -52,7 +52,8 @@ public class EchonetLiteBridgeHandler extends BaseBridgeHandler { private final ArrayBlockingQueue requests = new ArrayBlockingQueue<>(1024); private final Map devicesByKey = new HashMap<>(); private final EchonetMessageBuilder messageBuilder = new EchonetMessageBuilder(); - private final Thread networkingThread = new Thread(this::poll, "OH-binding-" + EchonetLiteBindingConstants.BINDING_ID); + private final Thread networkingThread = new Thread(this::poll, + "OH-binding-" + EchonetLiteBindingConstants.BINDING_ID); private final EchonetMessage echonetMessage = new EchonetMessage(); private final MonotonicClock clock = new MonotonicClock(); From 25244578bd43bcb1d4b926f4bdef731d11e3f6b9 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Mon, 25 Nov 2024 22:11:35 +0100 Subject: [PATCH 03/22] Spotless Signed-off-by: Leo Siepel --- .../org/openhab/binding/ekey/internal/handler/EkeyHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java index 2b9825781e331..ec5026f0d4338 100644 --- a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java +++ b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java @@ -84,7 +84,8 @@ public void initialize() { populateChannels(config.protocol); EkeyUdpPacketReceiver localReceiver = receiver = new EkeyUdpPacketReceiver( - Objects.requireNonNullElse(config.natIp, config.ipAddress), config.port, getThing().getUID().getAsString()); + Objects.requireNonNullElse(config.natIp, config.ipAddress), config.port, + getThing().getUID().getAsString()); localReceiver.addEkeyPacketListener(this); try { localReceiver.openConnection(); From 9195772fe41a10e81519a81c5d61aacfcf3dcea4 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Mon, 25 Nov 2024 22:50:49 +0100 Subject: [PATCH 04/22] Build fix Signed-off-by: Leo Siepel --- .../openhab/binding/insteon/internal/transport/LegacyPort.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java index 7f9263534f8c4..28ee847c0be02 100644 --- a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java +++ b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/transport/LegacyPort.java @@ -22,6 +22,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.insteon.internal.InsteonBindingConstants; import org.openhab.binding.insteon.internal.InsteonLegacyBindingConstants; import org.openhab.binding.insteon.internal.config.InsteonLegacyNetworkConfiguration; import org.openhab.binding.insteon.internal.device.InsteonAddress; From 83680692f06dccb71a938bf03c7c3bd3f502452a Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Tue, 26 Nov 2024 19:48:47 +0100 Subject: [PATCH 05/22] Fix build Signed-off-by: Leo Siepel --- .../binding/lutron/internal/handler/IPBridgeHandler.java | 3 ++- .../binding/lutron/internal/handler/LeapBridgeHandler.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java index ff64341b498ea..6f8e7cddde02d 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java @@ -216,7 +216,8 @@ private synchronized void connect() { sendCommand(new LIPCommand(TargetType.BRIDGE, LutronOperation.QUERY, LutronCommandType.SYSTEM, null, SYSTEM_DBEXPORTDATETIME)); - messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getBridgeUID() + "-IPBridgeSender"); + messageSender = new Thread(this::sendCommandsThread, + "OH-binding-" + getBridge().getBridgeUID() + "-IPBridgeSender"); messageSender.start(); logger.debug("Starting keepAlive job with interval {}", heartbeatInterval); diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java index 83761b4213228..13b0bdc2b9bb5 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java @@ -304,12 +304,14 @@ private synchronized void connect() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, STATUS_INITIALIZING); - Thread readerThread = new Thread(this::readerThreadJob, "OH-binding-" + getBridgeUID() + "-BridgeReader"); + Thread readerThread = new Thread(this::readerThreadJob, + "OH-binding-" + getBridge().getBridgeUID() + "-BridgeReader"); readerThread.setDaemon(true); readerThread.start(); this.readerThread = readerThread; - Thread senderThread = new Thread(this::senderThreadJob, "OH-binding-" + getBridgeUID() + "-BridgeSender"); + Thread senderThread = new Thread(this::senderThreadJob, + "OH-binding-" + getBridge().getBridgeUID() + "-BridgeSender"); senderThread.setDaemon(true); senderThread.start(); this.senderThread = senderThread; From 3d8cfaedeed6c65cbda4c276a1c48059f5f9aed2 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Tue, 26 Nov 2024 22:47:34 +0100 Subject: [PATCH 06/22] Fix build Signed-off-by: Leo Siepel --- .../openhab/binding/loxone/internal/security/LxWsSecurity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java b/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java index aef2134003b0b..65bd792a96ac9 100644 --- a/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java +++ b/bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/security/LxWsSecurity.java @@ -86,7 +86,7 @@ public void authenticate(BiConsumer doneCallback) { authenticationLock.unlock(); } }; - new Thread(init, "OH-binding-" + thingHandler.getThingUID() + "-Authenticate").start(); + new Thread(init, "OH-binding-" + thingHandler.getThingId() + "-Authenticate").start(); } /** From e381b313a85f7f88cf7f450881cc4ad1436cef31 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Wed, 27 Nov 2024 20:09:49 +0100 Subject: [PATCH 07/22] Build fix Signed-off-by: Leo Siepel --- .../binding/luxom/internal/handler/LuxomBridgeHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java index 19137dde5adcf..2dc53d9707c66 100644 --- a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java +++ b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java @@ -139,7 +139,7 @@ public void startProcessing() { updateStatus(ThingStatus.ONLINE); - messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getBridgeUID() + "-Sender"); + messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getBridge().getBridgeUID() + "-Sender"); messageSender.start(); logger.debug("Starting heartbeat job with interval {} (seconds)", HEARTBEAT_INTERVAL_SECONDS); From d6124699075bbe63e7db4c277cda49bc3d0a01d2 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Tue, 3 Dec 2024 20:07:55 +0100 Subject: [PATCH 08/22] Spotless Signed-off-by: Leo Siepel --- .../openhab/binding/mihome/internal/socket/XiaomiSocket.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java index bbb8b3a3848ef..ce5b229f07a21 100644 --- a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java +++ b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java @@ -71,7 +71,8 @@ public XiaomiSocket(String owner) { */ public XiaomiSocket(int port, String owner) { this.port = port; - socketReceiveThread.setName("OH-binding-" + this.getThing().getUID() + "-XiaomiSocket(" + port + ", " + owner + ")"); + socketReceiveThread + .setName("OH-binding-" + this.getThing().getUID() + "-XiaomiSocket(" + port + ", " + owner + ")"); } public void initialize() { From b7e6f957355563e45d4e33711dde64cad766b9eb Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Tue, 3 Dec 2024 20:20:11 +0100 Subject: [PATCH 09/22] Fix Bridge referring to Thing Signed-off-by: Leo Siepel --- .../binding/lutron/internal/handler/IPBridgeHandler.java | 3 +-- .../binding/lutron/internal/handler/LeapBridgeHandler.java | 6 ++---- .../binding/luxom/internal/handler/LuxomBridgeHandler.java | 2 +- .../binding/max/internal/handler/MaxCubeBridgeHandler.java | 2 +- .../tellstick/internal/core/TelldusCoreBridgeHandler.java | 2 +- .../internal/handler/VitotronicBridgeHandler.java | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java index 6f8e7cddde02d..c24ffe8f55c46 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/IPBridgeHandler.java @@ -216,8 +216,7 @@ private synchronized void connect() { sendCommand(new LIPCommand(TargetType.BRIDGE, LutronOperation.QUERY, LutronCommandType.SYSTEM, null, SYSTEM_DBEXPORTDATETIME)); - messageSender = new Thread(this::sendCommandsThread, - "OH-binding-" + getBridge().getBridgeUID() + "-IPBridgeSender"); + messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getThing().getUID() + "-IPBridgeSender"); messageSender.start(); logger.debug("Starting keepAlive job with interval {}", heartbeatInterval); diff --git a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java index 13b0bdc2b9bb5..f48d75fdb8ed7 100644 --- a/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java +++ b/bundles/org.openhab.binding.lutron/src/main/java/org/openhab/binding/lutron/internal/handler/LeapBridgeHandler.java @@ -304,14 +304,12 @@ private synchronized void connect() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, STATUS_INITIALIZING); - Thread readerThread = new Thread(this::readerThreadJob, - "OH-binding-" + getBridge().getBridgeUID() + "-BridgeReader"); + Thread readerThread = new Thread(this::readerThreadJob, "OH-binding-" + getThing().getUID() + "-BridgeReader"); readerThread.setDaemon(true); readerThread.start(); this.readerThread = readerThread; - Thread senderThread = new Thread(this::senderThreadJob, - "OH-binding-" + getBridge().getBridgeUID() + "-BridgeSender"); + Thread senderThread = new Thread(this::senderThreadJob, "OH-binding-" + getThing().getUID() + "-BridgeSender"); senderThread.setDaemon(true); senderThread.start(); this.senderThread = senderThread; diff --git a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java index 2dc53d9707c66..dd17af5fb7af9 100644 --- a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java +++ b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java @@ -139,7 +139,7 @@ public void startProcessing() { updateStatus(ThingStatus.ONLINE); - messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getBridge().getBridgeUID() + "-Sender"); + messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getThing().getUID()+ "-Sender"); messageSender.start(); logger.debug("Starting heartbeat job with interval {} (seconds)", HEARTBEAT_INTERVAL_SECONDS); diff --git a/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java b/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java index bf45390d303a7..4df534dd79634 100644 --- a/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java +++ b/bundles/org.openhab.binding.max/src/main/java/org/openhab/binding/max/internal/handler/MaxCubeBridgeHandler.java @@ -341,7 +341,7 @@ private synchronized void startAutomaticRefresh() { } if (queueConsumerThread == null || !queueConsumerThread.isAlive()) { queueConsumerThread = new Thread(new QueueConsumer(commandQueue), - "OH-binding-" + getBridge().getBridgeUID() + "-max-queue-consumer"); + "OH-binding-" + getThing().getUID() + "-max-queue-consumer"); queueConsumerThread.setDaemon(true); queueConsumerThread.start(); } diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java index 8b1387bd1bd28..08bd366afc2ca 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java @@ -130,7 +130,7 @@ public void initialize() { private void setupDeviceController(TellstickBridgeConfiguration configuration) { deviceController = new TelldusCoreDeviceController(configuration.resendInterval, - getBridge().getUID().getAsString()); + getThing().getUID().getAsString()); eventHandler.addListener((TelldusCoreDeviceController) deviceController); } diff --git a/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java b/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java index ba774c8b7176d..5c18d79855aa6 100644 --- a/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java +++ b/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicBridgeHandler.java @@ -276,7 +276,7 @@ private void startSocketReceiver() { if (!isConnect) { openSocket(); - Thread thread = new Thread(socketReceiverRunnable, "OH-binding-" + getBridge().getUID() + "-SocketThread"); + Thread thread = new Thread(socketReceiverRunnable, "OH-binding-" + getThing().getUID() + "-SocketThread"); thread.start(); } } From c3e0add5aa104a5590ba152183471227140ce5fe Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Tue, 3 Dec 2024 22:13:01 +0100 Subject: [PATCH 10/22] Spotless Signed-off-by: Leo Siepel --- .../binding/luxom/internal/handler/LuxomBridgeHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java index dd17af5fb7af9..ae7d77f391d1b 100644 --- a/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java +++ b/bundles/org.openhab.binding.luxom/src/main/java/org/openhab/binding/luxom/internal/handler/LuxomBridgeHandler.java @@ -139,7 +139,7 @@ public void startProcessing() { updateStatus(ThingStatus.ONLINE); - messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getThing().getUID()+ "-Sender"); + messageSender = new Thread(this::sendCommandsThread, "OH-binding-" + getThing().getUID() + "-Sender"); messageSender.start(); logger.debug("Starting heartbeat job with interval {} (seconds)", HEARTBEAT_INTERVAL_SECONDS); From dced3191f8bee715b8685d28a037a140310c98bd Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Tue, 3 Dec 2024 23:21:25 +0100 Subject: [PATCH 11/22] Fix mihome Signed-off-by: Leo Siepel --- .../openhab/binding/mihome/internal/socket/XiaomiSocket.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java index ce5b229f07a21..503f38e4d4eb7 100644 --- a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java +++ b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/socket/XiaomiSocket.java @@ -12,6 +12,8 @@ */ package org.openhab.binding.mihome.internal.socket; +import static org.openhab.binding.mihome.internal.XiaomiGatewayBindingConstants.BINDING_ID; + import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; @@ -71,8 +73,7 @@ public XiaomiSocket(String owner) { */ public XiaomiSocket(int port, String owner) { this.port = port; - socketReceiveThread - .setName("OH-binding-" + this.getThing().getUID() + "-XiaomiSocket(" + port + ", " + owner + ")"); + socketReceiveThread.setName("OH-binding-" + BINDING_ID + "-XiaomiSocket(" + port + ", " + owner + ")"); } public void initialize() { From 02b85ad962433e7904c64ab560365f1d590af295 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Wed, 4 Dec 2024 20:35:05 +0100 Subject: [PATCH 12/22] Fix some more Signed-off-by: Leo Siepel --- .../broadlink/internal/discovery/DiscoveryProtocol.java | 3 +++ .../binding/broadlink/internal/socket/BroadlinkSocket.java | 3 +++ .../binding/milight/internal/test/EmulatedV6Bridge.java | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java index d4841f47ab3b4..cd7684274a89a 100644 --- a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java +++ b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java @@ -12,6 +12,8 @@ */ package org.openhab.binding.broadlink.internal.discovery; +import static org.openhab.binding.broadlink.internal.BroadlinkBindingConstants.BINDING_ID; + import java.net.InetAddress; import java.net.UnknownHostException; import java.util.concurrent.TimeoutException; @@ -37,6 +39,7 @@ private static class AsyncDiscoveryThread extends Thread { AsyncDiscoveryThread(BroadlinkSocketListener listener, long timeoutMillis, DiscoveryFinishedListener finishedListener, Logger logger) { + super("OH-binding-" + BINDING_ID + "-AsyncDiscoveryThread"); this.listener = listener; this.timeoutMillis = timeoutMillis; this.finishedListener = finishedListener; diff --git a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java index c7c9169e92427..bade84e1bf7bb 100644 --- a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java +++ b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java @@ -12,6 +12,8 @@ */ package org.openhab.binding.broadlink.internal.socket; +import static org.openhab.binding.broadlink.internal.BroadlinkBindingConstants.BINDING_ID; + import java.io.IOException; import java.net.DatagramPacket; import java.net.InetAddress; @@ -99,6 +101,7 @@ private void receiveData(@Nullable MulticastSocket socket, DatagramPacket dgram) } private ReceiverThread(Logger logger) { + super("OH-binding-" + BINDING_ID + "-ReceiverThread"); this.logger = logger; } } diff --git a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java index bdbf8ccbcb800..75e5872a55df1 100644 --- a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java +++ b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/test/EmulatedV6Bridge.java @@ -92,8 +92,8 @@ public class EmulatedV6Bridge { FAKE_MAC[2], FAKE_MAC[3], FAKE_MAC[4], FAKE_MAC[5], 1 }; EmulatedV6Bridge() { - new Thread(this::runDiscovery,"OH-binding-" + MilightBindingConstants.BINDING_ID + "-runDiscovery").start(); - new Thread(this::runBridge,"OH-binding-" + MilightBindingConstants.BINDING_ID + "-runBridge").start(); + new Thread(this::runDiscovery, "OH-binding-" + MilightBindingConstants.BINDING_ID + "-runDiscovery").start(); + new Thread(this::runBridge, "OH-binding-" + MilightBindingConstants.BINDING_ID + "-runBridge").start(); } private void replaceWithMac(byte[] data, int offset) { From 7308a982a8c052f85312b14f59079f528eeb68ca Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Wed, 4 Dec 2024 21:58:51 +0100 Subject: [PATCH 13/22] Fix import Signed-off-by: Leo Siepel --- .../openhab/binding/milight/internal/protocol/QueuedSend.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java index 61acb63144cbe..06fc88dd3ca74 100644 --- a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java +++ b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java @@ -21,6 +21,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.milight.internal.MilightBindingConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From e9929782e9645fbf62f2be541b6534a87a6b7fdb Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Thu, 5 Dec 2024 18:20:50 +0100 Subject: [PATCH 14/22] Russound import Signed-off-by: Leo Siepel --- .../binding/russound/internal/net/SocketChannelSession.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java b/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java index 421475656f4f7..72ec3d5bbf00c 100644 --- a/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java +++ b/bundles/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/net/SocketChannelSession.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.openhab.binding.lutron.internal.grxprg.SocketSession; import org.openhab.binding.russound.internal.RussoundBindingConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From d5c3090d22208732e61ceae8a57d328b1d417bc0 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Thu, 5 Dec 2024 20:38:54 +0100 Subject: [PATCH 15/22] Fix last imports Signed-off-by: Leo Siepel --- .../org/openhab/binding/satel/internal/protocol/SatelModule.java | 1 + .../binding/shelly/internal/manager/ShellyManagerActionPage.java | 1 + .../binding/shelly/internal/manager/ShellyManagerOtaPage.java | 1 + 3 files changed, 3 insertions(+) diff --git a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java index 9d17bb1c4df98..84d23b8c6a8f8 100644 --- a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java +++ b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/protocol/SatelModule.java @@ -23,6 +23,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.satel.internal.SatelBindingConstants; import org.openhab.binding.satel.internal.command.IntegraVersionCommand; import org.openhab.binding.satel.internal.command.SatelCommand; import org.openhab.binding.satel.internal.command.SatelCommand.State; diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java index fa17d22bb0e08..7825e610d8b8e 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerActionPage.java @@ -24,6 +24,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.http.HttpStatus; +import org.openhab.binding.shelly.internal.ShellyBindingConstants; import org.openhab.binding.shelly.internal.ShellyHandlerFactory; import org.openhab.binding.shelly.internal.api.ShellyApiException; import org.openhab.binding.shelly.internal.api.ShellyApiInterface; diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java index 92d91ea663d5b..935c91bc15811 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/manager/ShellyManagerOtaPage.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpStatus; +import org.openhab.binding.shelly.internal.ShellyBindingConstants; import org.openhab.binding.shelly.internal.ShellyHandlerFactory; import org.openhab.binding.shelly.internal.api.ShellyApiException; import org.openhab.binding.shelly.internal.api.ShellyApiInterface; From bf4c7ad5b86878c8e6127579f651b89abb9c7591 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Thu, 5 Dec 2024 22:50:49 +0100 Subject: [PATCH 16/22] Fix result of conflict Signed-off-by: Leo Siepel --- .../broadlink/internal/discovery/DiscoveryProtocol.java | 2 ++ .../binding/broadlink/internal/socket/BroadlinkSocket.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java index d7afb8b33e45e..1f4fe26d8dab8 100644 --- a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java +++ b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/discovery/DiscoveryProtocol.java @@ -17,10 +17,12 @@ import java.util.concurrent.TimeoutException; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.broadlink.internal.BroadlinkBindingConstants; import org.openhab.binding.broadlink.internal.BroadlinkProtocol; import org.openhab.binding.broadlink.internal.NetworkUtils; import org.openhab.binding.broadlink.internal.socket.BroadlinkSocket; import org.openhab.binding.broadlink.internal.socket.BroadlinkSocketListener; +import org.slf4j.Logger; /** * @author John Marshall - Initial contribution diff --git a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java index 36ca8eecd76a3..4e4909c9b7ccc 100644 --- a/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java +++ b/bundles/org.openhab.binding.broadlink/src/main/java/org/openhab/binding/broadlink/internal/socket/BroadlinkSocket.java @@ -23,7 +23,9 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.broadlink.internal.BroadlinkBindingConstants; import org.openhab.binding.broadlink.internal.ModelMapper; +import org.slf4j.Logger; /** * Threaded socket implementation @@ -98,7 +100,7 @@ private void receiveData(@Nullable MulticastSocket socket, DatagramPacket dgram) } private ReceiverThread(Logger logger) { - super("OH-binding-" + BINDING_ID + "-ReceiverThread"); + super(String.format("OH-binding-%s-%s", BroadlinkBindingConstants.BINDING_ID, "Receiver")); this.logger = logger; } } From 22327d60587567c3baf2a792c032a6c56b209791 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Fri, 6 Dec 2024 10:26:59 +0100 Subject: [PATCH 17/22] Fix review comment Signed-off-by: Leo Siepel --- .../openhab/binding/hue/internal/connection/Clip2Bridge.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java index 5799c8b9bc58c..8ab2e06187f0e 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java @@ -70,7 +70,6 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Promise.Completable; import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.openhab.binding.hue.internal.HueBindingConstants; import org.openhab.binding.hue.internal.api.dto.clip1.CreateUserRequest; import org.openhab.binding.hue.internal.api.dto.clip1.SuccessResponse; import org.openhab.binding.hue.internal.api.dto.clip2.BridgeConfig; @@ -399,7 +398,7 @@ public void onGoAway(@Nullable Session session, @Nullable GoAwayFrame frame) { Objects.requireNonNull(session); if (session.equals(http2Session)) { Thread recreateThread = new Thread(() -> recreateSession(), - "OH-binding-" + HueBindingConstants.BINDING_ID + "-Clip2Bridge"); + "OH-binding-" + bridgeHandler.getThing().getUID() + "-Clip2Bridge"); Clip2Bridge.this.recreateThread = recreateThread; recreateThread.start(); } From 3db75e65333c63598560f9ceecae5d161fbb5b97 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Fri, 6 Dec 2024 12:22:24 +0100 Subject: [PATCH 18/22] Fix review comment 2 Signed-off-by: Leo Siepel --- .../openhab/binding/hue/internal/connection/Clip2Bridge.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java index 8ab2e06187f0e..9b23025491e3a 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/connection/Clip2Bridge.java @@ -398,7 +398,7 @@ public void onGoAway(@Nullable Session session, @Nullable GoAwayFrame frame) { Objects.requireNonNull(session); if (session.equals(http2Session)) { Thread recreateThread = new Thread(() -> recreateSession(), - "OH-binding-" + bridgeHandler.getThing().getUID() + "-Clip2Bridge"); + "OH-binding-" + bridgeHandler.getThing().getUID() + "-RecreateSession"); Clip2Bridge.this.recreateThread = recreateThread; recreateThread.start(); } From 2fb6ee46a360e0d9e83dd3faa273889279d3ee45 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sat, 7 Dec 2024 12:52:42 +0100 Subject: [PATCH 19/22] Update bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java Co-authored-by: Jacob Laursen Signed-off-by: lsiepel --- .../openhab/binding/milight/internal/protocol/QueuedSend.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java index 06fc88dd3ca74..b968f3bb24652 100644 --- a/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java +++ b/bundles/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/protocol/QueuedSend.java @@ -49,7 +49,7 @@ public class QueuedSend implements Runnable, Closeable { */ public void start() { willbeclosed = false; - thread = new Thread(this, "OH-binding-" + MilightBindingConstants.BINDING_ID + "-QueueSend"); + thread = new Thread(this, "OH-binding-" + MilightBindingConstants.BINDING_ID + "-QueuedSend"); thread.start(); } From df1aeddd3a0604b01f3f76f3da7dab9667e828d8 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sat, 7 Dec 2024 12:56:01 +0100 Subject: [PATCH 20/22] Update bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java Co-authored-by: Jacob Laursen Signed-off-by: lsiepel --- .../yeelight/internal/lib/device/connection/WifiConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java index 96fae82561455..4ed0061b0d361 100644 --- a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java +++ b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/device/connection/WifiConnection.java @@ -121,7 +121,7 @@ public boolean connect() { mDevice.setConnectionState(ConnectState.DISCONNECTED); mSocket = null; } - }, "OH-binding-" + YeelightBindingConstants.BINDING_ID + "-WIFIConnection"); + }, "OH-binding-" + YeelightBindingConstants.BINDING_ID + "-WifiConnection"); mConnectThread.start(); return false; } From 5a592ec48e85c35e75564725856b6d13b2f61836 Mon Sep 17 00:00:00 2001 From: Leo Siepel Date: Sat, 7 Dec 2024 12:56:24 +0100 Subject: [PATCH 21/22] Fix review comments Signed-off-by: Leo Siepel --- .../binding/ekey/internal/api/EkeyUdpPacketReceiver.java | 4 ++-- .../openhab/binding/ekey/internal/handler/EkeyHandler.java | 2 +- .../binding/intesis/internal/api/IntesisBoxSocketApi.java | 4 ++-- .../binding/intesis/internal/handler/IntesisBoxHandler.java | 2 +- .../tellstick/internal/core/TelldusCoreBridgeHandler.java | 2 +- .../tellstick/internal/core/TelldusCoreDeviceController.java | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java index cf58c3d5876ff..642f32a3dffe6 100644 --- a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java +++ b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java @@ -48,10 +48,10 @@ public class EkeyUdpPacketReceiver { private boolean connected = false; - public EkeyUdpPacketReceiver(final String ipAddress, final int port, final String thingUID) { + public EkeyUdpPacketReceiver(final String ipAddress, final int port, final String threadName) { this.ipAddress = ipAddress; this.port = port; - this.readerThreadName = "OH-binding-" + thingUID; + this.readerThreadName = threadName; } public void openConnection() throws IOException { diff --git a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java index ec5026f0d4338..22d10da448eed 100644 --- a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java +++ b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/handler/EkeyHandler.java @@ -85,7 +85,7 @@ public void initialize() { EkeyUdpPacketReceiver localReceiver = receiver = new EkeyUdpPacketReceiver( Objects.requireNonNullElse(config.natIp, config.ipAddress), config.port, - getThing().getUID().getAsString()); + "OH-binding-" + getThing().getUID()); localReceiver.addEkeyPacketListener(this); try { localReceiver.openConnection(); diff --git a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java index a144b43a1748b..83a33d6e1345c 100644 --- a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java +++ b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java @@ -52,10 +52,10 @@ public class IntesisBoxSocketApi { private boolean connected = false; - public IntesisBoxSocketApi(final String ipAddress, final int port, final String thingUID) { + public IntesisBoxSocketApi(final String ipAddress, final int port, final String threadName) { this.ipAddress = ipAddress; this.port = port; - this.readerThreadName = "OH-binding-" + thingUID; + this.readerThreadName = threadName; } private class IntesisSocket { diff --git a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java index db98feb252099..44ab794a716f6 100644 --- a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java +++ b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/handler/IntesisBoxHandler.java @@ -94,7 +94,7 @@ public void initialize() { updateStatus(ThingStatus.UNKNOWN); scheduler.submit(() -> { IntesisBoxSocketApi intesisLocalApi = intesisBoxSocketApi = new IntesisBoxSocketApi(config.ipAddress, - config.port, getThing().getUID().getAsString()); + config.port, "OH-binding-" + getThing().getUID()); intesisLocalApi.addIntesisBoxChangeListener(this); try { intesisLocalApi.openConnection(); diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java index 08bd366afc2ca..97b3f701be171 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreBridgeHandler.java @@ -130,7 +130,7 @@ public void initialize() { private void setupDeviceController(TellstickBridgeConfiguration configuration) { deviceController = new TelldusCoreDeviceController(configuration.resendInterval, - getThing().getUID().getAsString()); + "OH-binding-" + getThing().getUID() + "-worker"); eventHandler.addListener((TelldusCoreDeviceController) deviceController); } diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java index de04ab76838e3..a37e21352a248 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/core/TelldusCoreDeviceController.java @@ -55,11 +55,11 @@ public class TelldusCoreDeviceController implements DeviceChangeListener, Sensor private Thread workerThread; private SortedMap messageQue; - public TelldusCoreDeviceController(long resendInterval, String thingUID) { + public TelldusCoreDeviceController(long resendInterval, final String threadName) { this.resendInterval = resendInterval; messageQue = Collections.synchronizedSortedMap(new TreeMap<>()); telldusCoreWorker = new TelldusCoreWorker(messageQue); - workerThread = new Thread(telldusCoreWorker, "OH-binding-" + thingUID + "-worker"); + workerThread = new Thread(telldusCoreWorker, threadName); } @Override From 3e41a106a3999af1cfca4f47e75de7f8676b464e Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Sat, 7 Dec 2024 17:21:51 +0100 Subject: [PATCH 22/22] Apply suggestions from code review Revert unneeded changes Signed-off-by: Jacob Laursen --- .../binding/ekey/internal/api/EkeyUdpPacketReceiver.java | 4 ++-- .../binding/intesis/internal/api/IntesisBoxSocketApi.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java index 642f32a3dffe6..8648ca2eb5c13 100644 --- a/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java +++ b/bundles/org.openhab.binding.ekey/src/main/java/org/openhab/binding/ekey/internal/api/EkeyUdpPacketReceiver.java @@ -48,10 +48,10 @@ public class EkeyUdpPacketReceiver { private boolean connected = false; - public EkeyUdpPacketReceiver(final String ipAddress, final int port, final String threadName) { + public EkeyUdpPacketReceiver(final String ipAddress, final int port, final String readerThreadName) { this.ipAddress = ipAddress; this.port = port; - this.readerThreadName = threadName; + this.readerThreadName = readerThreadName; } public void openConnection() throws IOException { diff --git a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java index 83a33d6e1345c..55c249ba37567 100644 --- a/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java +++ b/bundles/org.openhab.binding.intesis/src/main/java/org/openhab/binding/intesis/internal/api/IntesisBoxSocketApi.java @@ -52,10 +52,10 @@ public class IntesisBoxSocketApi { private boolean connected = false; - public IntesisBoxSocketApi(final String ipAddress, final int port, final String threadName) { + public IntesisBoxSocketApi(final String ipAddress, final int port, final String readerThreadName) { this.ipAddress = ipAddress; this.port = port; - this.readerThreadName = threadName; + this.readerThreadName = readerThreadName; } private class IntesisSocket {