/** * Every time doHasNext() is called, check the WatchService for new events and add all new events * to the queue. Then return true if there are files on the queue, or false otherwise. * * <p>If the event indicates that a file has been deleted, ensure it is removed from the queue. */ @Override public boolean doHasNext() throws IOException, CollectionException { WatchKey key; while ((key = watcher.poll()) != null) { for (WatchEvent<?> event : key.pollEvents()) { processEvent(key, event); getMonitor().meter("events").mark(); } key.reset(); } return !currLines.isEmpty() || !queue.isEmpty(); }
/** * Every time doHasNext() is called, check the WatchService for new events and add all new events * to the queue. Then return true if there are files on the queue, or false otherwise. * * <p>If the event indicates that a file has been deleted, ensure it is removed from the queue. */ @Override public boolean doHasNext() throws IOException, CollectionException { WatchKey key; while ((key = watcher.poll()) != null) { for (WatchEvent<?> event : key.pollEvents()) { processEvent(key, event); getMonitor().meter("events").mark(); } key.reset(); } return !currLines.isEmpty() || !queue.isEmpty(); }
/** * Every time doHasNext() is called, check the WatchService for new events and add all new events * to the queue. Then return true if there are files on the queue, or false otherwise. * * <p>If the event indicates that a file has been deleted, ensure it is removed from the queue. */ @Override public boolean doHasNext() throws IOException, CollectionException { WatchKey key; while ((key = watcher.poll()) != null) { for (WatchEvent<?> event : key.pollEvents()) { processEvent(key, event); getMonitor().meter("events").mark(); } key.reset(); } return !queue.isEmpty(); }
/** * Every time doHasNext() is called, check the WatchService for new events and add all new events * to the queue. Then return true if there are files on the queue, or false otherwise. * * <p>If the event indicates that a file has been deleted, ensure it is removed from the queue. */ @Override public boolean doHasNext() throws IOException, CollectionException { WatchKey key; while ((key = watcher.poll()) != null) { for (WatchEvent<?> event : key.pollEvents()) { processEvent(key, event); getMonitor().meter("events").mark(); } key.reset(); } return !queue.isEmpty(); }
@Test public void testMetrics() { UimaMonitor monitor = new UimaMonitor(PIPELINE, this.getClass()); assertNotNull(monitor.counter("a")); assertNotNull(monitor.meter("b")); assertNotNull(monitor.histogram("c")); assertNotNull(monitor.timer("d")); }