Partial implementation client resilience
This commit is contained in:
@@ -48,8 +48,14 @@ public class LimitedMap<K, V> implements Map<K, V> {
|
||||
*/
|
||||
@Override
|
||||
public synchronized V put(K key, V value) {
|
||||
boolean added = true;
|
||||
if(map.size()==limit) {
|
||||
if(!map.containsKey(key))
|
||||
return null;
|
||||
added = false;
|
||||
}
|
||||
V result = map.put(key, value);
|
||||
if (map.size() >= limit) {
|
||||
if (map.size() >= limit && added) {
|
||||
action.run();
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user