USBDriveListener settings ?
Closed this issue · 1 comments
marttin-h commented
I use code:
driveDetector.getRemovableDevices().forEach(System.out::println);
driveDetector.addDriveListener (System.out :: System.out.println)
It just writes the USB drives connected to the computer and the program stops.
I try to set the poolin interval but without success.
How to permanently monitor the connection of a new USB flash?
Windows 10
Thanks
samuelcampos commented
Currently this library is using a daemon thread when a listener is registered. So, it does not prevent the JVM from exiting when the program finishes.
However this, would be an interesting improvement. I'll implement it.
In the meanwhile, you can create a new thread just to prevent the JVM from exiting. Something like this:
new Thread(() -> {
while(true) {
try {
Thread.sleep(20000);
} catch (InterruptedException ignored) {}
}
}).start();