Normalized thread names (#9581)

Related to #8216

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
Hilbrand Bouwkamp
2021-01-12 22:10:01 +01:00
committed by GitHub
parent 79dfb43e42
commit ac3f907b36
22 changed files with 75 additions and 43 deletions

View File

@@ -68,7 +68,8 @@ public class CaddxCommunicator implements SerialPortEventListener {
private boolean unStuff = false;
private int tempAsciiByte = 0;
public CaddxCommunicator(SerialPortManager portManager, CaddxProtocol protocol, String serialPortName, int baudRate)
public CaddxCommunicator(String uid, SerialPortManager portManager, CaddxProtocol protocol, String serialPortName,
int baudRate)
throws UnsupportedCommOperationException, PortInUseException, IOException, TooManyListenersException {
this.portManager = portManager;
this.protocol = protocol;
@@ -101,7 +102,7 @@ public class CaddxCommunicator implements SerialPortEventListener {
serialPort.notifyOnDataAvailable(true);
serialPort.addEventListener(this);
communicator = new Thread(this::messageDispatchLoop, "Caddx Communicator");
communicator = new Thread(this::messageDispatchLoop, "OH-binding-" + uid + "-caddxCommunicator");
communicator.setDaemon(true);
communicator.start();

View File

@@ -128,7 +128,8 @@ public class CaddxBridgeHandler extends BaseBridgeHandler implements CaddxPanelL
protocol);
try {
communicator = new CaddxCommunicator(portManager, protocol, serialPortName, baudRate);
communicator = new CaddxCommunicator(getThing().getUID().getAsString(), portManager, protocol,
serialPortName, baudRate);
} catch (IOException | TooManyListenersException | UnsupportedCommOperationException | PortInUseException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
"Communication cannot be initialized. " + e.toString());