checkOperation(OperationCategory.WRITE); checkNameNodeSafeMode("Cannot add cache directive"); effectiveDirective = FSNDNCacheOp.addCacheDirective(this, cacheManager, directive, flags, logRetryCache); success = true;
long addCacheDirective(CacheDirectiveInfo directive, EnumSet<CacheFlag> flags, boolean logRetryCache) throws IOException { final String operationName = "addCacheDirective"; CacheDirectiveInfo effectiveDirective = null; if (!flags.contains(CacheFlag.FORCE)) { cacheManager.waitForRescanIfNeeded(); } writeLock(); try { checkOperation(OperationCategory.WRITE); if (isInSafeMode()) { throw new SafeModeException( "Cannot add cache directive", safeMode); } effectiveDirective = FSNDNCacheOp.addCacheDirective(this, cacheManager, directive, flags, logRetryCache); } finally { writeUnlock(operationName); boolean success = effectiveDirective != null; if (success) { getEditLog().logSync(); } String effectiveDirectiveStr = effectiveDirective != null ? effectiveDirective.toString() : null; logAuditEvent(success, operationName, effectiveDirectiveStr, null, null); } return effectiveDirective != null ? effectiveDirective.getId() : 0; }
long addCacheDirective(CacheDirectiveInfo directive, EnumSet<CacheFlag> flags, boolean logRetryCache) throws IOException { final String operationName = "addCacheDirective"; CacheDirectiveInfo effectiveDirective = null; if (!flags.contains(CacheFlag.FORCE)) { cacheManager.waitForRescanIfNeeded(); } writeLock(); try { checkOperation(OperationCategory.WRITE); if (isInSafeMode()) { throw new SafeModeException( "Cannot add cache directive", safeMode); } effectiveDirective = FSNDNCacheOp.addCacheDirective(this, cacheManager, directive, flags, logRetryCache); } finally { writeUnlock(operationName); boolean success = effectiveDirective != null; if (success) { getEditLog().logSync(); } String effectiveDirectiveStr = effectiveDirective != null ? effectiveDirective.toString() : null; logAuditEvent(success, operationName, effectiveDirectiveStr, null, null); } return effectiveDirective != null ? effectiveDirective.getId() : 0; }