private void cancelWatchesForAttempt(AttemptPathIdentifier pathIdentifier) {
    // TODO May be possible to do finer-grained locks.
    synchronized(watchesPerAttempt) {
      List<WatchKey> list = watchesPerAttempt.remove(pathIdentifier);
      if (list != null) {
        for (WatchKey watchKey : list) {
          watchKey.cancel();
        }
      }
    }
  }
private void cancelWatchesForAttempt(AttemptPathIdentifier pathIdentifier) {
   
    synchronized(watchesPerAttempt) {
      List<WatchKey> list = watchesPerAttempt.remove(pathIdentifier);
      if (list != null) {
        for (WatchKey watchKey : list) {
          watchKey.cancel();
        }
      }
    }
  }
private void cancelwatchesforattempt(attemptpathidentifier pathidentifier) { synchronized(watchesperattempt) { list<watchkey> list = watchesperattempt.remove(pathidentifier); if (list != null) { for (watchkey watchkey : list) { watchkey.cancel(); } } } }