/** * Throws an exception if the CachePool does not have enough capacity to * cache the given path at the replication factor. * * @param pool CachePool where the path is being cached * @param path Path that is being cached * @param replication Replication factor of the path * @throws InvalidRequestException if the pool does not have enough capacity */ private void checkLimit(CachePool pool, String path, short replication) throws InvalidRequestException { CacheDirectiveStats stats = computeNeeded(path, replication); if (pool.getLimit() == CachePoolInfo.LIMIT_UNLIMITED) { return; } if (pool.getBytesNeeded() + stats.getBytesNeeded() > pool.getLimit()) { throw new InvalidRequestException("Caching path " + path + " of size " + stats.getBytesNeeded() / replication + " bytes at replication " + replication + " would exceed pool " + pool.getPoolName() + "'s remaining capacity of " + (pool.getLimit() - pool.getBytesNeeded()) + " bytes."); } }
/** * Throws an exception if the CachePool does not have enough capacity to * cache the given path at the replication factor. * * @param pool CachePool where the path is being cached * @param path Path that is being cached * @param replication Replication factor of the path * @throws InvalidRequestException if the pool does not have enough capacity */ private void checkLimit(CachePool pool, String path, short replication) throws InvalidRequestException { CacheDirectiveStats stats = computeNeeded(path, replication); if (pool.getLimit() == CachePoolInfo.LIMIT_UNLIMITED) { return; } if (pool.getBytesNeeded() + (stats.getBytesNeeded() * replication) > pool .getLimit()) { throw new InvalidRequestException("Caching path " + path + " of size " + stats.getBytesNeeded() / replication + " bytes at replication " + replication + " would exceed pool " + pool.getPoolName() + "'s remaining capacity of " + (pool.getLimit() - pool.getBytesNeeded()) + " bytes."); } }
/** * Throws an exception if the CachePool does not have enough capacity to * cache the given path at the replication factor. * * @param pool CachePool where the path is being cached * @param path Path that is being cached * @param replication Replication factor of the path * @throws InvalidRequestException if the pool does not have enough capacity */ private void checkLimit(CachePool pool, String path, short replication) throws InvalidRequestException { CacheDirectiveStats stats = computeNeeded(path, replication); if (pool.getLimit() == CachePoolInfo.LIMIT_UNLIMITED) { return; } if (pool.getBytesNeeded() + (stats.getBytesNeeded() * replication) > pool .getLimit()) { throw new InvalidRequestException("Caching path " + path + " of size " + stats.getBytesNeeded() / replication + " bytes at replication " + replication + " would exceed pool " + pool.getPoolName() + "'s remaining capacity of " + (pool.getLimit() - pool.getBytesNeeded()) + " bytes."); } }