[infinispan-issues] [JBoss JIRA] (ISPN-3396) Multiple classloader key store/lookup fails, even with storeAsBinary

Ales Justin (JIRA) jira-events at lists.jboss.org
Tue Aug 6 08:41:26 EDT 2013


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

Ales Justin commented on ISPN-3396:
-----------------------------------

This exposes the issue:

    @SuppressWarnings("unchecked")
    public void testDiffClassloaders() throws Exception {
        URL core = ReclosableLatch.class.getProtectionDomain().getCodeSource().getLocation();
        URL tests = getClass().getResource("/");
        ClassLoader cl1 = new URLClassLoader(new URL[]{core, tests}, null);
        ClassLoader cl2 = new URLClassLoader(new URL[]{core, tests}, null);

        ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false);
        builder.storeAsBinary().enable();
        Cache cache = TestCacheManagerFactory.createCacheManager(builder).getCache();

        Object key1 = cl1.loadClass(Key.class.getName()).getConstructor(String.class, Boolean.TYPE).newInstance("key1", false);
        Object key2 = cl2.loadClass(Key.class.getName()).getConstructor(String.class, Boolean.TYPE).newInstance("key1", false);

        ClassLoader kcl1 = key1.getClass().getClassLoader();
        ClassLoader kcl2 = key2.getClass().getClassLoader();
        //AssertJUnit.assertFalse(kcl1.equals(kcl2));

        String value = "tralala";
        cache.put(key1, value);
        Object result = cache.get(key2);
        AssertJUnit.assertNotNull(result);
        AssertJUnit.assertEquals(value, result);
    }

                
> Multiple classloader key store/lookup fails, even with storeAsBinary
> --------------------------------------------------------------------
>
>                 Key: ISPN-3396
>                 URL: https://issues.jboss.org/browse/ISPN-3396
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Marshalling
>    Affects Versions: 5.3.0.Final, 6.0.0.Alpha2
>            Reporter: Galder Zamarreño
>            Assignee: Galder Zamarreño
>             Fix For: 6.0.0.Final
>
>
> Same key, multiple classloaders. Storing from one classloader cannot be found from the other, even when storeAsBinary is enabled (even with defensive=true). [IRC chat debugging issue|https://gist.github.com/galderz/63163644fee0c27d66c7].

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the infinispan-issues mailing list