assert namesystem.hasWriteLock();
// Remove the corresponding entry in directivesByPath.
String path = directive.getPath();
List<CacheDirective> directives = directivesByPath.get(path);
if (directives == null || !directives.remove(directive)) {
throw new InvalidRequestException("Failed to locate entry " +
directive.getId() + " by path " + directive.getPath());
}
if (directives.size() == 0) {
directivesByPath.remove(path);
}