Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-4095

Flag.SKIP_LISTENER_NOTIFICATION does not work for CacheEntryModifiedEvent and CacheEntryCreatedEvent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 10.0.0.Beta3
    • 6.0.0.Final, 7.0.0.Alpha1
    • Listeners
    • None

    Description

      When setting Flag.SKIP_LISTENER_NOTIFICATION, listener still can be invoked when new entry is created or entry is modified.

      I check the change log and found it should be caused by logic in CacheNotifierImpl, it did not check the flag on createEntry and modifyEntry event.

      You can reproduce it by the code below:
      public class TestInfinispan {

      public static void main(String[] args)

      { Cache<String, String> testCache = new DefaultCacheManager().getCache(); testCache.addListener(new TestListener()); AdvancedCache<String, String> advancedCache = testCache.getAdvancedCache(); advancedCache = advancedCache.withFlags(Flag.SKIP_LISTENER_NOTIFICATION); advancedCache.put("key1", "value1"); advancedCache.replace("key1", "value2"); }

      @Listener
      private static class TestListener {

      @CacheEntryModified
      public void cacheEntryModified(CacheEntryModifiedEvent event)

      { System.out.println( "######## modify event with key " + event.getKey() + " and value " + event.getValue() ); }

      @CacheEntryCreated
      public void cacheEntryCreated(CacheEntryCreatedEvent event)

      { System.out.println( "######## create event with key " + event.getKey() + " and value " + event.getValue() ); }

      }
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hbhztianwei tina tian (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: