code: final void removePathEntry(final String pathName, boolean check) throws OperationFailedException{
          synchronized (pathEntries) {
              PathEntry pathEntry = pathEntries.get(pathName);
              if (pathEntry.isReadOnly()) {
                  throw ControllerLogger.ROOT_LOGGER.pathEntryIsReadOnly(pathName);
              }
  
              Set<String> dependents = dependenctRelativePaths.get(pathName);
              if (check && dependents != null) {
                  throw ControllerLogger.ROOT_LOGGER.cannotRemovePathWithDependencies(pathName, dependents);
              }
              pathEntries.remove(pathName);
              triggerCallbacksForEvent(pathEntry, Event.REMOVED);
              if (pathEntry.getRelativeTo() != null) {
                  dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo());
                  if (dependents != null) {
                      dependents.remove(pathEntry.getName());
                      if (dependents.size() == 0) {
                          dependenctRelativePaths.remove(pathEntry.getRelativeTo());
                      }
                  }
              }
          }
      }
docs: Removes the entry for a path and sends an {@link org.jboss.as.controller.services.path.PathManager.Event#REMOVED}
  notification to any registered
  {@linkplain org.jboss.as.controller.services.path.PathManager.Callback#pathEvent(Event, PathEntry) callbacks}.
  @param pathName the logical name of the path within the model. Cannot be {@code null}
  @param check {@code true} if a check for the existence of other paths that depend on {@code pathName}
  as their {@link PathEntry#getRelativeTo() relative-to} value should be performed
  @throws OperationFailedException if {@code check} is {@code true} and other paths depend on the path being removed