2 Replies Latest reply on Apr 9, 2013 12:16 AM by drathnow

    CacheEntryCreated event--again

    drathnow

      I'm trying to implement some code that takes actions whenever an entry is created in one of my Infinispan caches.  I realized quickly that the CacheEntryCreatedEvent object delieved to my @CacheEntryCreated method does not contain the newly created entry so I went searching for a solution.

       

      I found various discussions about the problem with the solution being to catch the @CacheEntryModified event that is delivered after the @CacheEntryCreated event and take the object when the isPre()=false.  However, I think I missed something because in all the disucssions none address the situation where you have a modification event that represent a elgitimate modification of an existing entry and not a creation.

       

      Does this mean that my @Listener object has to maintain state information between the delivery of events?  My @CacheEntryModified has to integate the event object, determine its a create event (i.e. getValue() == null && isPre() == true) and then wait for the next @CacheEntryModified event before grabbing the newly created object?

       

      This bring up the obvious question of what to do if another @Listener object vetoes the modification before the second @CacheEntryModified (i.e. isPre() == false) event is delivered?

       

      How do other peopel handle this situation?