/** * Get size of the Queue for keyName. This is only used in unit tests. * @param keyName the key name * @return int queue size */ public int getSize(String keyName) { readLock(keyName); try { // We can't do keyQueues.get(keyName).size() here, // since that will have the side effect of populating the cache. Map<String, LinkedBlockingQueue<E>> map = keyQueues.getAllPresent(Arrays.asList(keyName)); if (map.get(keyName) == null) { return 0; } return map.get(keyName).size(); } finally { readUnlock(keyName); } }
public Map<StorableKey, Storable> getAll(Collection<? extends StorableKey> keys) { return guavaCache.getAllPresent(keys); }
public Map<StorableKey, Storable> getAll(Collection<? extends StorableKey> keys) { return guavaCache.getAllPresent(keys); }
public void removeAll(Collection<? extends StorableKey> keys) { final ImmutableMap<StorableKey, Storable> allPresent = guavaCache.getAllPresent(keys); guavaCache.invalidateAll(keys); }
public void removeAll(Collection<? extends StorableKey> keys) { final ImmutableMap<StorableKey, Storable> allPresent = guavaCache.getAllPresent(keys); guavaCache.invalidateAll(keys); }
/** * Get size of the Queue for keyName. This is only used in unit tests. * @param keyName the key name * @return int queue size */ public int getSize(String keyName) { // We can't do keyQueues.get(keyName).size() here, // since that will have the side effect of populating the cache. Map<String, LinkedBlockingQueue<E>> map = keyQueues.getAllPresent(Arrays.asList(keyName)); if (map.get(keyName) == null) { return 0; } return map.get(keyName).size(); }
DatanodeInfo[] getExcludedNodes() { return excludedNodes.getAllPresent(excludedNodes.asMap().keySet()) .keySet().toArray(new DatanodeInfo[0]); }
DatanodeInfo[] getExcludedNodes() { return excludedNodes.getAllPresent(excludedNodes.asMap().keySet()) .keySet().toArray(new DatanodeInfo[0]); }
@Override public Map<String, T> lookup(Set<String> keys) { ImmutableMap<String, T> cached = cache.getAllPresent(keys); Set<String> missingKeys = Sets.difference(keys, cached.keySet()); Map<String, T> missing = delegate.lookup(missingKeys); cache.putAll(missing); return ImmutableMap.<String, T>builder() .putAll(cached) .putAll(missing) .build(); } }