@Override public boolean remove(final ContentClaim claim) { if (claim == null) { return false; } final ContentClaim backupClaim = getBackupClaim(claim); if (backupClaim == null) { final ContentBlock content = claimMap.remove(claim); if (content == null) { logger.debug("Removed {} from repo but it did not exist", claim); } else { logger.debug("Removed {} from repo; Content = {}", claim, content); content.destroy(); } } else { getBackupRepository().remove(backupClaim); } return true; }
@Override public void purge() { for (final ContentClaim claim : claimMap.keySet()) { claimManager.decrementClaimantCount(resolveClaim(claim).getResourceClaim()); final ContentClaim backup = getBackupClaim(claim); if (backup != null) { getBackupRepository().remove(backup); } } }
/** * Destroys a ContentClaim that was being written to but is no longer needed * * @param claim claim to destroy */ private void destroyContent(final ContentClaim claim) { if (claim == null) { return; } final int decrementedClaimCount = context.getContentRepository().decrementClaimantCount(claim); if (decrementedClaimCount <= 0) { resetWriteClaims(); // Have to ensure that we are not currently writing to the claim before we can destroy it. context.getContentRepository().remove(claim); } }