2 Replies Latest reply on Oct 10, 2011 1:22 PM by jmbarone

    Inside CacheEntryCreated event i can't see the new data

    jmbarone

      Hi.

      Thanks for the great work with infinispan.

      Well, i have a pretty normal listener on a cache, but inside a method that catch CacheEntryCreatedEvent events i cannot obtain the data associated with the new key.

       

      The source code of the java class:

       

      @Listener

      public class CacheListener{

          @CacheEntryCreated

          public void entry(CacheEntryCreatedEvent<Object, Object> event){

              if (event.isPre()) return;

                 

              Object key = event.getKey();

              Object data = cache.get(key);

                 

              log.info("[" + key +  "] = [" + data + "]");

          }

      }

       

      The CacheListener it's an inner class so i can access the cache variable (cache).

      I always see

       

      [key] = [null]

       

      as the result.

       

      if i query the cache after the put, the value exists, but inside the method i showed ... no. Why?...

       

      Thanks.