@Test public void testFilelistener() throws FileNotFoundException, ClassNotFoundException, IOException, ResourceNotExistingException, TTException { Filelistener.addFilelistener(RESOURCE_1, TMPDIR_1.getAbsolutePath()); Filelistener.addFilelistener(RESOURCE_2, TMPDIR_2.getAbsolutePath()); filelistener.watchDir(TMPDIR_1); filelistener.watchDir(TMPDIR_2); filelistener.startListening(); assertNotNull(filelistener.getTrx(RESOURCE_1)); assertNotNull(filelistener.getTrx(RESOURCE_2)); assertEquals(2, Filelistener.getFilelisteners().size()); byte[] bytesToWrite = new byte[1024 * 1024 * 2]; Random rand = new Random(42); rand.nextBytes(bytesToWrite); Files.write(bytesToWrite, new File(TMPDIR_1 + File.separator + "file1.txt")); Files.write(bytesToWrite, new File(TMPDIR_2 + File.separator + "file1.txt")); Files.write(bytesToWrite, new File(TMPDIR_1 + File.separator + "file2.txt")); Files.write(bytesToWrite, new File(TMPDIR_2 + File.separator + "file2.txt")); filelistener.shutDownListener(); }
public Filelistener() throws IOException { this.mWatcher = FileSystems.getDefault().newWatchService(); mSubDirectories = new HashMap<String, List<String>>(); mExecutorMap = new HashMap<String, ExecutorService>(); }
Filelistener { public Filelistener() throws IOException { this.mWatcher = FileSystems.getDefault().newWatchService(); mSubDirectories = new HashMap<String, List<String>>(); mExecutorMap = new HashMap<String, ExecutorService>(); } }
Filelistener { public Filelistener() throws IOException { this.mWatcher = FileSystems.getDefault().newWatchService(); mSubDirectories = new HashMap<String, List<String>>(); mExecutorMap = new HashMap<String, ExecutorService>(); } Filelistener(); }
Filelistener { public Filelistener() throws IOException { this.mWatcher = FileSystems.getDefault().newWatchService(); mSubDirectories = new HashMap<String, List<String>>(); mExecutorMap = new HashMap<String, ExecutorService>(); } Filelistener(); FilesystemNotificationObserver getObserver(); void setObserver(FilesystemNotificationObserver pObserver); void watchDir(File dir); void startListening(); void shutDownListener(); static Map<String, String> getFilelisteners(); static boolean addFilelistener(String pResourcename, String pListenerPath); boolean removeFilelistener(String pResourcename); synchronized IFilelistenerWriteTrx getTrx(String key); }
Filelistener { public Filelistener() throws IOException { this.mWatcher = FileSystems.getDefault().newWatchService(); mSubDirectories = new HashMap<String, List<String>>(); mExecutorMap = new HashMap<String, ExecutorService>(); } Filelistener(); FilesystemNotificationObserver getObserver(); void setObserver(FilesystemNotificationObserver pObserver); void watchDir(File dir); void startListening(); void shutDownListener(); static Map<String, String> getFilelisteners(); static boolean addFilelistener(String pResourcename, String pListenerPath); boolean removeFilelistener(String pResourcename); synchronized IFilelistenerWriteTrx getTrx(String key);  }