Skip to content

Commit

Permalink
ConcurrentMap functional api
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowak M. (Marcin) committed Dec 12, 2022
1 parent 46fc28f commit 7aaf742
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,10 @@ public Collection<String> getCacheNames() {
@Override
@Nullable
public Cache getCache(String name) {
Cache cache = this.cacheMap.get(name);
if (cache == null && this.dynamic) {
synchronized (this.cacheMap) {
cache = this.cacheMap.get(name);
if (cache == null) {
cache = createConcurrentMapCache(name);
this.cacheMap.put(name, cache);
}
}
}
return cache;
if (this.dynamic)
return this.cacheMap.computeIfAbsent(name, this::createConcurrentMapCache);

return this.cacheMap.get(name);
}

private void recreateCaches() {
Expand Down

0 comments on commit 7aaf742

Please sign in to comment.