[
https://issues.jboss.org/browse/ISPN-4563?page=com.atlassian.jira.plugin....
]
Galder Zamarreño commented on ISPN-4563:
----------------------------------------
Sebastian, the TCK is correct, {{createCache}} should throw a CacheException if the cache
is already known, as indicated in the Javadoc. The problem here is that this kind of API
forces you to do this in the cache resolver implementation:
{code}
Cache ... = getCache();
if (c != null) return c;
else ... createCache
{code}
However, this kind of code will only work if it's synchronized somehow to deal with
concurrent environments. The RI follows this pattern too, but it does not synchronize
stuff.
Race condition in JCache creation for interceptors
--------------------------------------------------
Key: ISPN-4563
URL:
https://issues.jboss.org/browse/ISPN-4563
Project: Infinispan
Issue Type: Bug
Components: CDI Integration
Affects Versions: 6.0.2.Final
Reporter: Elias Ross
Assignee: Sebastian Łaskawiec
Fix For: 7.0.0.Final
Intercepted methods, annotated like @CacheResult, if called from multiple threads, can
attempt to create multiple caches.
Work-around is to create the cache in a @PostContruct block.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)