[infinispan-issues] [JBoss JIRA] (ISPN-4563) Race condition in JCache creation for interceptors

Galder Zamarreño (JIRA) issues at jboss.org
Tue Sep 16 09:44:02 EDT 2014


    [ https://issues.jboss.org/browse/ISPN-4563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002878#comment-13002878 ] 

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)



More information about the infinispan-issues mailing list