weliem / blessed-bluez

BLE library using Java and Bluez
MIT License
76 stars 21 forks source link

remaining thread did not shutdown? #17

Closed zhuyuemings closed 1 year ago

zhuyuemings commented 1 year ago

remaining thread: Thread[main,5,main]:isAlive=true remaining thread: Thread[DBusConnection,5,main]:isAlive=true remaining thread: Thread[DBus Sender Thread-1,5,main]:isAlive=true remaining thread: Thread[DbusWorkerThreads1,5,main]:isAlive=true remaining thread: Thread[Central-callback,5,main]:isAlive=true remaining thread: Thread[Central-queue,5,main]:isAlive=true remaining thread: Thread[Central-signal,5,main]:isAlive=true

zhuyuemings commented 1 year ago

i add those code to stop remaining thread in BluetoothCentralManager.java

public void shutdown(){
        callBackHandler.shutdown();
        queueHandler.shutdown();
        signalHandler.shutdown();
        try {
            adapter.getDBusConnection().close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
weliem commented 1 year ago

Please raise a PR. Looks like a good addition...

weliem commented 1 year ago

Thanks for the PR, merged it