aboutsummaryrefslogtreecommitdiffstats
path: root/examples/java/DBTPeripheral00.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-02-08 13:06:08 +0100
committerSven Gothel <[email protected]>2022-02-08 13:06:08 +0100
commita1ea89e5cd1d98b42e7a236160d83fd7104c9027 (patch)
tree1ab9f7f230427628afb0368419b4053dc728d018 /examples/java/DBTPeripheral00.java
parentf618578f53213a3e5599ffbe44a09a09b7d046e1 (diff)
DBTPeripheral00/DBTServer00: Issue device.remove() in processDisconnectedDevice(..)
device.remove() shall ensure to clear all device references from its BTAdapter to avoid leaks.
Diffstat (limited to 'examples/java/DBTPeripheral00.java')
-rw-r--r--examples/java/DBTPeripheral00.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/examples/java/DBTPeripheral00.java b/examples/java/DBTPeripheral00.java
index 8589258e..1de34acb 100644
--- a/examples/java/DBTPeripheral00.java
+++ b/examples/java/DBTPeripheral00.java
@@ -621,7 +621,9 @@ public class DBTPeripheral00 {
// already unpaired
stopAdvertising(device.getAdapter(), "device-disconnected");
+ device.remove();
BTDeviceRegistry.removeFromProcessingDevices(device.getAddressAndType());
+
try {
Thread.sleep(100); // wait a little (FIXME: Fast restart of advertising error)
} catch (final InterruptedException e) { }