private void removeInternal(CacheDirective directive) throws InvalidRequestException { 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); } // Fix up the stats from removing the pool final CachePool pool = directive.getPool(); directive.addBytesNeeded(-directive.getBytesNeeded()); directive.addFilesNeeded(-directive.getFilesNeeded()); directivesById.remove(directive.getId()); pool.getDirectiveList().remove(directive); assert directive.getPool() == null; setNeedsRescan(); }
private void removeInternal(CacheDirective directive) throws InvalidRequestException { 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); } // Fix up the stats from removing the pool final CachePool pool = directive.getPool(); directive.addBytesNeeded(-directive.getBytesNeeded()); directive.addFilesNeeded(-directive.getFilesNeeded()); directivesById.remove(directive.getId()); pool.getDirectiveList().remove(directive); assert directive.getPool() == null; setNeedsRescan(); }
private void removeInternal(CacheDirective directive) throws InvalidRequestException { 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); } // Fix up the stats from removing the pool final CachePool pool = directive.getPool(); directive.addBytesNeeded(-directive.getBytesNeeded()); directive.addFilesNeeded(-directive.getFilesNeeded()); directivesById.remove(directive.getId()); pool.getDirectiveList().remove(directive); assert directive.getPool() == null; setNeedsRescan(); }