code: @Override
      public synchronized boolean registerForNotifications(ArtifactNotification targets, ArtifactListener callbackObject) throws IllegalArgumentException {
          verifyTargets(targets);
  
          //build the aggregate set of paths to monitor from the caller's args.
          //addTarget will always add the listener, but will return false if the
          //path is already in the monitor list..
          Set<String> pathsToMonitor = new HashSet<String>();
          for (String path : targets.getPaths()) {
              //do not remove the ! paths here.. as they must be passed onto the other containers.
              ArtifactListenerSelector artifactSelectorCallback = new ArtifactListenerSelector(callbackObject);
              boolean addToMonitorList = addTarget(path, artifactSelectorCallback);
              if (addToMonitorList) {
                  pathsToMonitor.add(path);
              }
          }
  
          //figure out the new minset of paths to monitor.
          pathsToMonitor.addAll(pathsMonitored);
          collapsePaths(pathsToMonitor);
  
          //if we're already listening, we need to stop briefly to update the list..
          if (listeningToContainers) {
              overlayContainer.getArtifactNotifier().removeListener(this);
              overlaidContainer.getArtifactNotifier().removeListener(this);
          }
          pathsMonitored.clear();
          pathsMonitored.addAll(pathsToMonitor);
          overlayContainer.getArtifactNotifier().registerForNotifications(new DefaultArtifactNotification(overlayContainer, pathsMonitored), this);
          overlaidContainer.getArtifactNotifier().registerForNotifications(new DefaultArtifactNotification(overlaidContainer, pathsMonitored), this);
          listeningToContainers = true;
  
          return true;
      }
docs: {@inheritDoc}