[infinispan-issues] [JBoss JIRA] (ISPN-1583) AbstractDelegatingAdvancedCache with(ClassLoader), withFlags(Flag...) logic is broken

Paul Ferraro (Commented) (JIRA) jira-events at lists.jboss.org
Thu Dec 1 18:07:40 EST 2011


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

Paul Ferraro commented on ISPN-1583:
------------------------------------

FYI - I've implemented a simple workaround for this in AS7.
See: https://github.com/pferraro/jboss-as/blob/AS7-2704/clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/AbstractAdvancedCache.java

Implementations need only implement the abstract wrap(AdvancedCache<K, V>) method.
                
> AbstractDelegatingAdvancedCache with(ClassLoader), withFlags(Flag...) logic is broken
> -------------------------------------------------------------------------------------
>
>                 Key: ISPN-1583
>                 URL: https://issues.jboss.org/browse/ISPN-1583
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Core API
>    Affects Versions: 5.1.0.BETA5
>            Reporter: Paul Ferraro
>            Assignee: Manik Surtani
>            Priority: Critical
>             Fix For: 5.1.0.CR1
>
>
> When the withFlags(...) logic was modified to use a DecoratedCache instead of thread-local storage, any caches already decorated with the AbstractDelegatingAdvancedCache(...) broke.
> Take the following code:
> AdvancedCache<K, V> baseCache;
> AdvancedCache<K, V> customCache = new AbstractDelegatingAdvancedCache<K, V>(baseCache) {
>   public void clear() {
>      // custom clear logic
>   }
> };
> customCache.withFlags(Flag.CACHE_MODE_LOCAL).clear();
> In the above statement, the flag is not applied.
> The call to withFlags(...) returns a reference to customCache, and the reference to DecoratedCache containing the flags is lost to garbage collection.
> In the case of with(ClassLoader) we have the opposite problem.
> customCache.with(customClassLoader).clear();
> In the above statement, the native clear() method is invoked instead of my custom clear() method. with(ClassLoader) returns a reference to DecoratedCache.  The clear() method then operates on baseCache, instead of customCache.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the infinispan-issues mailing list