/** * Adds a file to be monitored. * * @param file The FileObject to add. */ private void doAddFile(final FileObject file) { synchronized (this.monitorMap) { if (this.monitorMap.get(file.getName()) == null) { this.monitorMap.put(file.getName(), new FileMonitorAgent(this, file)); try { if (this.listener != null) { file.getFileSystem().addListener(file, this.listener); } if (file.getType().hasChildren() && this.recursive) { // Traverse the children final FileObject[] children = file.getChildren(); for (final FileObject element : children) { this.addFile(element); // Add depth first } } } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } } }
/** * Adds a file to be monitored. * * @param file The FileObject to add. */ private void doAddFile(final FileObject file) { synchronized (this.monitorMap) { if (this.monitorMap.get(file.getName()) == null) { this.monitorMap.put(file.getName(), new FileMonitorAgent(this, file)); try { if (this.listener != null) { file.getFileSystem().addListener(file, this.listener); } if (file.getType().hasChildren() && this.recursive) { // Traverse the children final FileObject[] children = file.getChildren(); for (final FileObject element : children) { this.addFile(element); // Add depth first } } } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } } }
/** * Adds a file to be monitored. * * @param file The FileObject to add. */ private void doAddFile(final FileObject file) { synchronized (this.monitorMap) { if (this.monitorMap.get(file.getName()) == null) { this.monitorMap.put(file.getName(), new FileMonitorAgent(this, file)); try { if (this.listener != null) { file.getFileSystem().addListener(file, this.listener); } if (file.getType().hasChildren() && this.recursive) { // Traverse the children final FileObject[] children = file.getChildren(); for (final FileObject element : children) { this.addFile(element); // Add depth first } } } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } } }
this.monitorMap.put(file.getName(), new FileMonitorAgent(this, file));