private void process(final Path path) throws IOException { final Processor processor = getProcessor(); if (processor != null) { processing.incrementAndGet(); try { executor.execute(new Runnable() { @Override public void run() { try { processor.process(path); lastModified = System.currentTimeMillis(); } finally { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } } } }); } catch (RejectedExecutionException e) { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } throw e; } } }
private void process(final Path path) throws IOException { final Processor processor = getProcessor(); if (processor != null) { processing.incrementAndGet(); try { executor.execute(new Runnable() { @Override public void run() { try { processor.process(path); lastModified = System.currentTimeMillis(); } finally { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } } } }); } catch (RejectedExecutionException e) { processing.decrementAndGet(); synchronized (processing) { processing.notifyAll(); } throw e; } } }
private void unscan(final Path file) throws IOException { if (isMatchesFile(file)) { Processor processor = getProcessor(); if (processor != null) { processor.onRemove(file); } lastModified = System.currentTimeMillis(); } else { // lets find all the files that now no longer exist List<Path> files = new ArrayList<Path>(processedMap.keySet()); for (Path path : files) { if (!Files.exists(path)) { LOGGER.debug("File has been deleted: " + path); processedMap.remove(path); if (isMatchesFile(path)) { Processor processor = getProcessor(); if (processor != null) { processor.onRemove(path); } fireListeners(path, ENTRY_DELETE); lastModified = System.currentTimeMillis(); } } } } }
private void unscan(final Path file) throws IOException { if (isMatchesFile(file)) { Processor processor = getProcessor(); if (processor != null) { processor.onRemove(file); } lastModified = System.currentTimeMillis(); } else { // lets find all the files that now no longer exist List<Path> files = new ArrayList<Path>(processedMap.keySet()); for (Path path : files) { if (!Files.exists(path)) { LOGGER.debug("File has been deleted: " + path); processedMap.remove(path); if (isMatchesFile(path)) { Processor processor = getProcessor(); if (processor != null) { processor.onRemove(path); } fireListeners(path, ENTRY_DELETE); lastModified = System.currentTimeMillis(); } } } } }