@Test public void testAddFiles() throws Exception { final File testDir = this.tempDir.newFolder(); final String filePrefix = "test"; SingerLogConfig config = createSingerLogConfig(filePrefix, testDir.getAbsolutePath()); LogStream toMonitor = new LogStream(new SingerLog(config), filePrefix); FileSystemMonitor t = new FileSystemMonitor(Arrays.asList(toMonitor), "testAddFiles"); verifyFiles(testDir.list(), toMonitor); int NUM_FILES = 10; File[] created = new File[NUM_FILES]; for (int i = 0; i < NUM_FILES; i++) { created[i] = File.createTempFile(filePrefix, "", testDir); } t.start(); Thread.sleep(FILE_EVENT_WAIT_TIME_MS); verifyFiles(testDir.list(), toMonitor); }
public void start() { if(thread == null) { thread = new Thread(this); thread.setName("FileSystemMonitor-" + name); thread.start(); } }
FileSystemMonitor implements Runnable { public void start() { if(thread == null) { thread = new Thread(this); thread.setName("FileSystemMonitor-" + name); thread.start(); } } }
FileSystemMonitor implements Runnable { public void start() { if(thread == null) { thread = new Thread(this); thread.setName("FileSystemMonitor-" + name); thread.start(); } } FileSystemMonitor(String name);  FileSystemMonitor(SingerConfig singerConfig, String name);  FileSystemMonitor(Collection<LogStream> streamsToWatch, String name); }
FileSystemMonitor implements Runnable { public void start() { if(thread == null) { thread = new Thread(this); thread.setName("FileSystemMonitor-" + name); thread.start(); } } FileSystemMonitor(String name);  FileSystemMonitor(SingerConfig singerConfig, String name);  FileSystemMonitor(Collection<LogStream> streamsToWatch, String name); void start(); void stop(); void join(); void registerPath(Path logDir); @VisibleForTesting void processFileSystemEvents(); void updateAllDirectories(); boolean isRunning(); @Override void run(); void destroy(); }
FileSystemMonitor implements Runnable { public void start() { if(thread == null) { thread = new Thread(this); thread.setName("FileSystemMonitor-" + name); thread.start(); } } FileSystemMonitor(String name);  FileSystemMonitor(SingerConfig singerConfig, String name);  FileSystemMonitor(Collection<LogStream> streamsToWatch, String name); void start(); void stop(); void join(); void registerPath(Path logDir); @VisibleForTesting void processFileSystemEvents(); void updateAllDirectories(); boolean isRunning(); @Override void run(); void destroy();  }