code: public synchronized void setStorageDirectories(Collection<URI> fsNameDirs,
                                            Collection<URI> fsEditsDirs,
                                            Map<URI, NNStorageLocation> locationMap)
        throws IOException {
      
      this.storageDirs.clear();
      this.removedStorageDirs.clear();
  
      for (URI dirName : fsNameDirs) {
        boolean isAlsoEdits = false;
        for (URI editsDirName : fsEditsDirs) {
          if (editsDirName.compareTo(dirName) == 0) {
            isAlsoEdits = true;
            fsEditsDirs.remove(editsDirName);
            break;
          }
        }
        NameNodeDirType dirType = (isAlsoEdits) ?
                            NameNodeDirType.IMAGE_AND_EDITS :
                            NameNodeDirType.IMAGE;
        // Add to the list of storage directories, only if the
        // URI is of type file://
        if (dirName.getScheme().compareTo(JournalType.FILE.name().toLowerCase()) == 0) {
          this.addStorageDir(new NNStorageDirectory(new File(dirName.getPath()),
              dirType, locationMap == null ? null : locationMap.get(dirName)));
        }
      }
      
      // Add edits dirs if they are different from name dirs
      for (URI dirName : fsEditsDirs) {
        checkSchemeConsistency(dirName);
        // Add to the list of storage directories, only if the
        // URI is of type file://
        if (dirName.getScheme().compareTo(JournalType.FILE.name().toLowerCase()) == 0)
          this.addStorageDir(new NNStorageDirectory(new File(dirName.getPath()),
              NameNodeDirType.EDITS, locationMap == null ? null : locationMap.get(dirName)));
      }
    }
docs: Set the storage directories which will be used. This should only ever be
  called from inside NNStorage. However, it needs to remain package private
  for testing, as StorageDirectories need to be reinitialised after using
  Mockito.spy() on this class, as Mockito doesn't work well with inner
  classes, such as StorageDirectory in this case.
  
  Synchronized due to initialization of storageDirs and removedStorageDirs.
  
  @param fsNameDirs Locations to store images.
  @param fsEditsDirs Locations to store edit logs.
  @param locationMap location descriptors
  @throws IOException