gnodet-bot commented on code in PR #28822:
URL: https://github.com/apache/camel/pull/28822#discussion_r4439708473
##########
components/camel-ehcache/src/main/java/org/apache/camel/component/ehcache/EhcacheManager.java:
##########
@@ -187,6 +164,27 @@ public <K, V> Cache<K, V> getCache(String name, Class<K>
keyType, Class<V> value
return cache;
}
+ /**
+ * Creates a cache with the given configuration, or returns the existing
one if another thread raced to create it
+ * first. Ehcache throws {@link IllegalArgumentException} when two callers
create the same cache concurrently; this
+ * method catches that and falls back to {@link CacheManager#getCache}.
+ */
+ @SuppressWarnings("unchecked")
Review Comment:
🔹 **Unnecessary `@SuppressWarnings("unchecked")`** on
`createCacheOrGetExisting`. Both `CacheManager.createCache(String,
CacheConfiguration<K, V>)` and `CacheManager.getCache(String, Class<K>,
Class<V>)` are fully generic in the Ehcache API — no unchecked cast occurs
here. The annotation can be removed.
```suggestion
private <K, V> Cache<K, V> createCacheOrGetExisting(
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]