Reset the watch key after processing events. watckKey -> watchKey

This commit is contained in:
Cameron Gutman committed 2015-02-19 19:38:08 -05:00
1 parent 7f580a9cc0
commit 5b20f16d44
1 file changed
+6 -2
+6 -2
View File
@@ -91,8 +91,8 @@ public class EvdevLoader implements Runnable {
evdev.register(watcher, StandardWatchEventKinds.ENTRY_CREATE); evdev.register(watcher, StandardWatchEventKinds.ENTRY_CREATE);
for (;;) { for (;;) {
WatchKey watckKey = watcher.take(); WatchKey watchKey = watcher.take();
List<WatchEvent<?>> events = watckKey.pollEvents(); List<WatchEvent<?>> events = watchKey.pollEvents();
for (WatchEvent event:events) { for (WatchEvent event:events) {
if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) { if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) {
String name = event.context().toString(); String name = event.context().toString();
@@ -102,6 +102,10 @@ public class EvdevLoader implements Runnable {
} }
} }
} }
if (!watchKey.reset()) {
break;
}
} }
} catch (IOException | InterruptedException ex) { } catch (IOException | InterruptedException ex) {
LimeLog.severe(ex.getMessage()); LimeLog.severe(ex.getMessage());