/*
public void removeWatch(String path, DatabaseWatch watchDatabase)
{
_fileWatch.unwatch(watchDatabase, path);
_dirWatch.watch(watchDatabase, path);
}
541094
private ArrayList<String> getBindList(String path)
  {
    if (! path.endsWith("/")) {
      path = path + "/";
    }

    ArrayList<String> bindList = new ArrayList<>();

    for (String bindPath : _bindMap.keySet()) {
      if (bindPath.startsWith(path)) {
        int p = bindPath.indexOf('/', path.length());

        String subpath = null;

        if (p > 0) {
          subpath = bindPath.substring(path.length(), p);
        }
        else {
          subpath = bindPath.substring(path.length());
        }

        if (! bindList.contains(subpath)) {
          bindList.add(subpath);
        }
      }
    }

    return bindList;
  }
416420
function watchFile(file, callback) {
	let absolutePath = File.find(file).path();
	let watcher = chokidar
		.watch(
			absolutePath,
			{
				persistent: true
			}
		)
		.on(
			'change',
			function () {
				if (typeof callback === 'function') {
					callback(file);
				}
				watcher.unwatch(absolutePath);
				watchFile(file, callback);
			}
		)
	;
}
1347387
public void delete(String path) {
        OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_DELETE_URL);
        request.addQuerystringParameter("root", "dropbox");
        request.addQuerystringParameter("path", encode(path));

        service.signRequest(accessToken, request);
        checkDelete(request.send());
    }
493739
def _remove_watch_block(self, wb):
		
		if (self._wbslock == None):
			self._wbslock = Lock()

		self._wbslock.acquire()
		self._wbs.remove(wb)
		if len(self._wbs) == 0:
			self._stop_enqueue_thread()
			self._stop_dequeue_thread()

		self._wbslock.release()
479830
function unwatchPath(path) {
    Object.keys(_watcherMap).forEach(function (keyPath) {
        if (keyPath.indexOf(path) === 0) {
            _unwatchPath(keyPath);
        }
    });
}
590535
def unregister_data_path(path)
      path = File.expand_path(path)

      self.data_paths.delete(path)
      return DataPaths.unregister!(path)
    end
762113
public void deletePath(final Path path, final boolean recursive) {
    this.futures.add(new NamedFuture(this.executor.submit(new Callable<Void>() {
      @Override
      public Void call() throws Exception {
        Lock lock = ParallelRunner.this.locks.get(path.toString());
        lock.lock();
        try {
          HadoopUtils.deletePath(ParallelRunner.this.fs, path, recursive);
          return null;
        } finally {
          lock.unlock();
        }
      }
    }), "Delete path " + path));
  }
74833
def delete_watch(self, id, params=None):
        
        if id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'id'.")
        return self.transport.perform_request(
            "DELETE", _make_path("_watcher", "watch", id), params=params
        )
200795
function(file) {
    for(var i = 0; i < watchList.length; i++) {
        if(watchList[i].file === file) {
            watchers[i].close();
            watchList.splice(i, 1);
            watchers.splice(i, 1);
            return;
        }
    }
    throw new Error(file + " was not being watched previously");
}
139401
@Deprecated
    public void addWatcher(Path file, Watcher watcher) {
        addWatcher(file, (Listener) watcher);
    }
593098
public void removePath(int pathIndex) {
		_verifyAllStreams();
		int pathCount = getPathCount();

		if (pathIndex < 0)
			pathIndex = pathCount - 1;

		if (pathIndex >= pathCount)
			throw new IllegalArgumentException();

		boolean bDirtyRingAreas2D = _hasDirtyFlag(DirtyFlags.DirtyRingAreas2D);

		int removedPathStart = getPathStart(pathIndex);
		int removedPathSize = getPathSize(pathIndex);

		// Remove the attribute values for the path
		for (int iattr = 0, nattr = m_description.getAttributeCount(); iattr < nattr; iattr++) {
			if (m_vertexAttributes[iattr] != null) {
				int semantics = m_description._getSemanticsImpl(iattr);
				int comp = VertexDescription.getComponentCount(semantics);
				m_vertexAttributes[iattr].eraseRange(comp * removedPathStart,
						comp * removedPathSize, comp * m_pointCount);
			}
		}

		// Change the start of each path after the removed path
		for (int i = pathIndex + 1; i <= pathCount; i++) {
			int istart = m_paths.read(i);
			m_paths.write(i - 1, istart - removedPathSize);
		}

		if (m_pathFlags == null) {
			for (int i = pathIndex + 1; i <= pathCount; i++) {
				byte flags = m_pathFlags.read(i);
				m_pathFlags.write(i - 1, flags);
			}
		}

		m_paths.resize(pathCount);
		m_pathFlags.resize(pathCount);
		m_pointCount -= removedPathSize;
		m_reservedPointCount -= removedPathSize;

		notifyModified(DirtyFlags.DirtyCoordinates);
	}
1082367
@Deprecated
    public void stopWatching(File file) {
        if (file == null) {
            throw new IllegalArgumentException("Null file argument");
        }
        synchronized (mutex) {
            stopWatchingInternal(file.toPath());
        }
    }
236075
public void watchDirectoryTree(Path dir) {
    if (_watchedDirectories == null) {
      throw new IllegalStateException("DirectoryWatcher.close() was called. Please make a new instance.");
    }
    try {
      if (Files.exists(dir)) {
        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
          @Override
          public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
            watchDirectory(dir);
            return FileVisitResult.CONTINUE;
          }
        });
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
960671
@Override
	public void run() {
		while (!stopWatching.get()) {
			WatchKey key;
			try {
				key = watchService.take();
			} catch (InterruptedException | ClosedWatchServiceException e) {
				close();
				return;
			}
			if (key != null) {
				Path dir = keys.get(key);
				if (dir == null) {
					LOGGER.warn("WatchKey not recognized!!");
					continue;
				}

				for (WatchEvent<?> event : key.pollEvents()) {
					WatchEvent.Kind<?> kind = event.kind();

					if (kind == OVERFLOW) {
						continue;
					}

					// Context for directory entry event is the file name of
					// entry
					Path path = (Path) event.context();
					Path resolvedPath = ((Path) key.watchable()).resolve(path);

					boolean isDir = Files.isDirectory(resolvedPath, NOFOLLOW_LINKS);
					Path dirPath = null;
					if (isDir) {
						dirPath = ((Path) key.watchable());
					} else {
						dirPath = resolvedPath.getParent();
					}

					JawrWatchEvent evt = new JawrWatchEvent(kind, resolvedPath, dirPath);
					watchEvents.add(evt);
				}

				// reset key and remove from set if directory no longer
				// accessible
				boolean valid = key.reset();
				if (!valid) {
					keys.remove(key);

					// all directories are inaccessible
					if (keys.isEmpty()) {
						break;
					}
				}
			}
		}
		close();
	}
1206646
public void watch(Watcher watcher) throws WatchException{
		if(isClosed){
			throw new WatchException("Watch Monitor is closed !");
		}
		registerPath();
//		log.debug("Start watching path: [{}]", this.path);
		
		while (false == isClosed) {
			WatchKey wk;
			try {
				wk = watchService.take();
			} catch (InterruptedException e) {
//				log.warn(e);
				return;
			}
			
			final Path currentPath = watchKeyPathMap.get(wk);
			WatchEvent.Kind<?> kind;
			for (WatchEvent<?> event : wk.pollEvents()) {
				kind = event.kind();
				if(null != this.filePath && false == this.filePath.endsWith(event.context().toString())){
//					log.debug("[{}] is not fit for [{}], pass it.", event.context(), this.filePath.getFileName());
					continue;
				}
				
				if(kind == StandardWatchEventKinds.ENTRY_CREATE){
					watcher.onCreate(event, currentPath);
				}else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
					watcher.onModify(event, currentPath);
				}else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
					watcher.onDelete(event, currentPath);
				}else if(kind == StandardWatchEventKinds.OVERFLOW){
					watcher.onOverflow(event, currentPath);
				}
			}
			wk.reset();
		}
	}
992313
public static void removeEntry(final File zip, final String path) {
    operateInPlace(zip, new InPlaceAction() {
      public boolean act(File tmpFile) {
        removeEntry(zip, path, tmpFile);
        return true;
      }
    });
  }
1150627
void removeCache(Path hdfsPath) {
    CacheEntry c = cacheMap.remove(hdfsPath);
    if (c != null) {
      cacheSize.addAndGet(-c.entrySize);
      localMetrics.numRemove++;
      if (LOG.isDebugEnabled()) {
        LOG.debug("LookasideCache removed path:" + hdfsPath +
                  " freed up size: " + c.entrySize);
      }
    }
  }