Prevent duplicate event listeners (#20554)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein
2026-04-11 22:01:24 +02:00
committed by GitHub
parent b4686a2f0e
commit bfe85ceae3
3 changed files with 5 additions and 5 deletions
@@ -462,9 +462,9 @@ public class MonopriceAudioHandler extends BaseThingHandler implements Monoprice
private synchronized void closeConnection() {
if (connector.isConnected()) {
connector.close();
connector.removeEventListener(this);
logger.debug("closeConnection(): disconnected");
}
connector.removeEventListener(this);
}
@Override
@@ -698,10 +698,10 @@ public class MonopriceAudioHandler extends BaseThingHandler implements Monoprice
* @param channelType the channel type to be updated
*/
private void updateChannelState(String zoneId, String channelType) {
MonopriceAudioZoneDTO zoneData = zoneDataMap.get(zoneId);
final MonopriceAudioZoneDTO zoneData = zoneDataMap.get(zoneId);
if (zoneData != null) {
String channel = amp.getZoneName(zoneId) + CHANNEL_DELIMIT + channelType;
final String channel = amp.getZoneName(zoneId) + CHANNEL_DELIMIT + channelType;
if (!isLinked(channel)) {
return;
@@ -680,10 +680,10 @@ public class NuvoHandler extends BaseThingHandler implements NuvoMessageEventLis
private synchronized void closeConnection() {
if (connector.isConnected()) {
connector.close();
connector.removeEventListener(this);
pollStatusNeeded = true;
logger.debug("closeConnection(): disconnected");
}
connector.removeEventListener(this);
}
/**
@@ -379,9 +379,9 @@ public class OppoHandler extends BaseThingHandler implements OppoMessageEventLis
if (connector.isConnected()) {
connector.close();
connector.removeEventListener(this);
logger.debug("closeConnection(): disconnected");
}
connector.removeEventListener(this);
}
/**