[infinispan-issues] [JBoss JIRA] Resolved: (ISPN-881) A listener which receives CacheEntryCreatedEvent + CacheEntryModifiedEvent events always has a null value after a Cache.put while a Cache.put which replaces delivers the actual value.

Manik Surtani (JIRA) jira-events at lists.jboss.org
Wed Jan 19 06:55:49 EST 2011


     [ https://issues.jboss.org/browse/ISPN-881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manik Surtani resolved ISPN-881.
--------------------------------

    Resolution: Rejected


> A listener which receives CacheEntryCreatedEvent + CacheEntryModifiedEvent events always has a null value after a Cache.put while a Cache.put which replaces delivers the actual value.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ISPN-881
>                 URL: https://issues.jboss.org/browse/ISPN-881
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Listeners
>    Affects Versions: 4.2.0.CR3
>         Environment: N/A
>            Reporter: Miroslav Pokorny
>            Assignee: Manik Surtani
>
> It would be advantageous if the beheaviour of the delivered modify events did not deliver null values after a put which is different from a put which replaces which does deliver the actual value. It is also not possible to take the key from the create event and try and read the cache. I have tried printing both when the Event.isPre() field is false and true and the value is null.
> Please examine the provided test harness which includes some prints the output which demonstrates the problem...
> ---
> package miroslav.pokorny.cache.infinispan;
> import org.infinispan.manager.DefaultCacheManager;
> import org.infinispan.manager.EmbeddedCacheManager;
> import org.infinispan.notifications.Listener;
> import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
> import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
> import org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent;
> import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
> public class InfinispanValueProblemTest {
>     private final static String KEY = "key";
>     private final static String VALUE = "*Value*";
>     static public void main(final String[] ignored) {
>         final EmbeddedCacheManager manager = new DefaultCacheManager();
>         final org.infinispan.Cache<String, String> cache = manager.getCache();
>         cache.addListener(new InfinispanCacheListener());
>         cache.put(KEY, VALUE);
>     }
>     @Listener
>     static final public class InfinispanCacheListener {
>         @CacheEntryCreated
>         public void entryCreated(final CacheEntryCreatedEvent<String, String> event) {
>             System.out.println("CREATE EVENT\n\t" + event.getKey() + "= cant do get value\n\tisPre=" + event.isPre()
>                     + "\n\tevent.getCache().get(event.getKey())=" + event.getCache().get(event.getKey()));
>         }
>         @CacheEntryModified
>         public void entryModified(final CacheEntryModifiedEvent<String, String> event) {
>             System.out.println("MODIFIED EVENT\n\t" + event.getKey() + "=" + event.getValue() + "\n\tisPre=" + event.isPre()
>                     + "\n\tevent.getCache().get(event.getKey())=" + event.getCache().get(event.getKey()));
>         }
>     }
> }
> -------------------------------------------
> Running the test should print something like this
> [       GlobalComponentRegistry] - Infinispan version: Infinispan 'Ursus' 4.2.0.CR3
> [             ComponentRegistry] - Infinispan version: Infinispan 'Ursus' 4.2.0.CR3
> CREATE EVENT
> 	key= cant do get value
> 	isPre=true
> 	event.getCache().get(event.getKey())=null
> CREATE EVENT
> 	key= cant do get value
> 	isPre=false
> 	event.getCache().get(event.getKey())=null
> MODIFIED EVENT
> 	key=null
> 	isPre=true
> 	event.getCache().get(event.getKey())=null
> MODIFIED EVENT
> 	key=*Value*
> 	isPre=false
> 	event.getCache().get(event.getKey())=null

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the infinispan-issues mailing list