/** * Create a cache pool. * * Only the superuser should be able to call this function. * * @param info The info for the cache pool to create. * @return Information about the cache pool we created. */ public CachePoolInfo addCachePool(CachePoolInfo info) throws IOException { assert namesystem.hasWriteLock(); CachePool pool; try { CachePoolInfo.validate(info); String poolName = info.getPoolName(); pool = cachePools.get(poolName); if (pool != null) { throw new InvalidRequestException("Cache pool " + poolName + " already exists."); } pool = CachePool.createFromInfoAndDefaults(info); cachePools.put(pool.getPoolName(), pool); } catch (IOException e) { LOG.info("addCachePool of " + info + " failed: ", e); throw e; } LOG.info("addCachePool of {} successful.", info); return pool.getInfo(true); }
/** * Create a cache pool. * * Only the superuser should be able to call this function. * * @param info The info for the cache pool to create. * @return Information about the cache pool we created. */ public CachePoolInfo addCachePool(CachePoolInfo info) throws IOException { assert namesystem.hasWriteLock(); CachePool pool; try { CachePoolInfo.validate(info); String poolName = info.getPoolName(); pool = cachePools.get(poolName); if (pool != null) { throw new InvalidRequestException("Cache pool " + poolName + " already exists."); } pool = CachePool.createFromInfoAndDefaults(info); cachePools.put(pool.getPoolName(), pool); } catch (IOException e) { LOG.info("addCachePool of " + info + " failed: ", e); throw e; } LOG.info("addCachePool of {} successful.", info); return pool.getInfo(true); }
/** * Create a cache pool. * * Only the superuser should be able to call this function. * * @param info The info for the cache pool to create. * @return Information about the cache pool we created. */ public CachePoolInfo addCachePool(CachePoolInfo info) throws IOException { assert namesystem.hasWriteLock(); CachePool pool; try { CachePoolInfo.validate(info); String poolName = info.getPoolName(); pool = cachePools.get(poolName); if (pool != null) { throw new InvalidRequestException("Cache pool " + poolName + " already exists."); } pool = CachePool.createFromInfoAndDefaults(info); cachePools.put(pool.getPoolName(), pool); } catch (IOException e) { LOG.info("addCachePool of " + info + " failed: ", e); throw e; } LOG.info("addCachePool of {} successful.", info); return pool.getInfo(true); }