class ListenerTask implements Runnable {

    @Override
    public void run() {
        try (WatchService watcher = watchService) {
            scanExistFiles();

            for (;;) {
                WatchKey key = watcher.take();

                for (WatchEvent<?> event : key.pollEvents()) {
                    if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) {
                        Path file = ((Path) event.context());
                        Path dirAndFile = fileSystem.getPath(directory.getPath()).resolve(file);
                        newFileAction.execute(new info.smart_tools.smartactors.base.path.Path(dirAndFile));
                    }
                }

                if (!key.reset()) {
                    break;
                }
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } catch (IOException | ActionExecuteException | InvalidArgumentException e) {
            throw new RuntimeException(e);
        }
    }

    public  ListenerTask(final IPath directory, final IAction<IPath> newFileAction);
      ListenerTask(final IPath directory, final IAction<IPath> newFileAction, final FileSystem fileSystem);

}