diff --git a/bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal/BlueZBluetoothDevice.java b/bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal/BlueZBluetoothDevice.java index af80f79d2f1..86a134823cd 100644 --- a/bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal/BlueZBluetoothDevice.java +++ b/bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal/BlueZBluetoothDevice.java @@ -120,6 +120,10 @@ public class BlueZBluetoothDevice extends BaseBluetoothDevice implements BlueZEv public void dispose() { BluetoothDevice dev = device; if (dev != null) { + if (Boolean.TRUE.equals(dev.isPaired())) { + return; + } + try { dev.getAdapter().removeDevice(dev.getRawDevice()); } catch (DBusException ex) { @@ -359,8 +363,10 @@ public class BlueZBluetoothDevice extends BaseBluetoothDevice implements BlueZEv } BluetoothCharacteristic c = getCharacteristic(UUID.fromString(characteristic.getUuid())); if (c != null) { - c.setValue(event.getData()); - notifyListeners(BluetoothEventType.CHARACTERISTIC_UPDATED, c, BluetoothCompletionStatus.SUCCESS); + synchronized (c) { + c.setValue(event.getData()); + notifyListeners(BluetoothEventType.CHARACTERISTIC_UPDATED, c, BluetoothCompletionStatus.SUCCESS); + } } }