3 Replies Latest reply on Dec 16, 2011 8:33 AM by Nicolas Filotto

    Is this an L1 Cache inconsistency issue?

    Nicolas Filotto Novice

      Hi all,


      I'm currently testing ISPN (ISPN 5.1.0.CR1) as a distributed cache which means that by default I have the L1/Near Cache enabled and during my tests I faced a weird issue that sounds like an inconsitency issue. See below the unit test to reproduce:



         public void testConsistency() throws Exception
            GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
            gc.fluent().transport().addProperty("configurationFile", "udp.xml");
            Configuration c = new Configuration();
            EmbeddedCacheManager cm1 = new DefaultCacheManager(gc, c);
            EmbeddedCacheManager cm2 = new DefaultCacheManager(gc, c);
            Cache cache1 = cm1.getCache();
            Cache cache2 = cm2.getCache();
            KeyAffinityService keyAffinityService =
               KeyAffinityServiceFactory.newLocalKeyAffinityService(cache1, new RndKeyGenerator(),
                  Executors.newSingleThreadExecutor(), 100);
            Object localKey = keyAffinityService.getKeyForAddress(cm1.getAddress());
            cache1.put(localKey, "foo");
            assertEquals("foo", cache1.get(localKey));
            assertEquals("foo", cache2.get(localKey));
            cache1.put(localKey, "foo2");
            assertEquals("foo2", cache1.get(localKey));
            assertEquals("foo2", cache2.get(localKey));
            cache2.put(localKey, "foo3");
            assertEquals("foo3", cache1.get(localKey));
            assertEquals("foo3", cache2.get(localKey));


      Could you please tell me if it is a bug? If not could you please tell me what's wrong with my code/configuration?


      Please find as attached file the source code of my test case.


      Thank you in advance for your help,