code: @Override
      public synchronized boolean removeListener(ArtifactListener listenerToRemove) {
          // Wrap the input artifact listener in a ArtifactListenerSelector.
          ArtifactListenerSelector listenerSelectorToRemove = new ArtifactListenerSelector(listenerToRemove);
  
          //this isn't too frequent an operation, so the implementation is a little unoptimal ;p
          boolean success = false;
  
          //find all the places where the listener is registered..
          //2 pass. pass#1 find affected paths.
          Set<String> pathsToRemove = new HashSet<String>();
          for (Map.Entry<String, Collection<ArtifactListenerSelector>> listenersByPath : listeners.entrySet()) {
              for (ArtifactListenerSelector listener : listenersByPath.getValue()) {
                  if (listener.equals(listenerSelectorToRemove)) {
                      pathsToRemove.add(listenersByPath.getKey());
                  }
              }
          }
          //2 pass. pass#2 process affected paths.
          for (String path : pathsToRemove) {
              Collection<ArtifactListenerSelector> listenersForPath = listeners.get(path);
              if (listenersForPath.size() == 1) {
                  //only person listening to this path just left..
                  listeners.remove(path);
              } else {
                  //other parties still care about this path..
                  listenersForPath.remove(listenerSelectorToRemove);
              }
          }
  
          pathsMonitored.clear();
          pathsMonitored.addAll(listeners.keySet());
          collapsePaths(pathsMonitored);
          if (listeningToContainers) {
              overlayContainer.getArtifactNotifier().removeListener(this);
              overlaidContainer.getArtifactNotifier().removeListener(this);
          }
  
          if (pathsMonitored.size() > 0) {
              overlayContainer.getArtifactNotifier().registerForNotifications(new DefaultArtifactNotification(overlayContainer, pathsMonitored), this);
              overlaidContainer.getArtifactNotifier().registerForNotifications(new DefaultArtifactNotification(overlaidContainer, pathsMonitored), this);
          } else {
              listeningToContainers = false;
          }
  
          if (pathsToRemove.size() > 0) {
              success = true;
          }
          return success;
      }
docs: {@inheritDoc}