public BatchedListEntries<CachePoolEntry> listCachePools(FSPermissionChecker pc, String prevKey) { assert namesystem.hasReadLock(); final int NUM_PRE_ALLOCATED_ENTRIES = 16; ArrayList<CachePoolEntry> results = new ArrayList<CachePoolEntry>(NUM_PRE_ALLOCATED_ENTRIES); SortedMap<String, CachePool> tailMap = cachePools.tailMap(prevKey, false); int numListed = 0; for (Entry<String, CachePool> cur : tailMap.entrySet()) { if (numListed++ >= maxListCachePoolsResponses) { return new BatchedListEntries<CachePoolEntry>(results, true); } results.add(cur.getValue().getEntry(pc)); } return new BatchedListEntries<CachePoolEntry>(results, false); }
public BatchedListEntries<CachePoolEntry> listCachePools(FSPermissionChecker pc, String prevKey) { assert namesystem.hasReadLock(); final int NUM_PRE_ALLOCATED_ENTRIES = 16; ArrayList<CachePoolEntry> results = new ArrayList<CachePoolEntry>(NUM_PRE_ALLOCATED_ENTRIES); SortedMap<String, CachePool> tailMap = cachePools.tailMap(prevKey, false); int numListed = 0; for (Entry<String, CachePool> cur : tailMap.entrySet()) { if (numListed++ >= maxListCachePoolsResponses) { return new BatchedListEntries<CachePoolEntry>(results, true); } results.add(cur.getValue().getEntry(pc)); } return new BatchedListEntries<CachePoolEntry>(results, false); }
public BatchedListEntries<CachePoolEntry> listCachePools(FSPermissionChecker pc, String prevKey) { assert namesystem.hasReadLock(); final int NUM_PRE_ALLOCATED_ENTRIES = 16; ArrayList<CachePoolEntry> results = new ArrayList<CachePoolEntry>(NUM_PRE_ALLOCATED_ENTRIES); SortedMap<String, CachePool> tailMap = cachePools.tailMap(prevKey, false); int numListed = 0; for (Entry<String, CachePool> cur : tailMap.entrySet()) { if (numListed++ >= maxListCachePoolsResponses) { return new BatchedListEntries<CachePoolEntry>(results, true); } results.add(cur.getValue().getEntry(pc)); } return new BatchedListEntries<CachePoolEntry>(results, false); }