]
Dan Berindei closed ISPN-4095.
------------------------------
Fix Version/s: 10.0.0.Beta3
Resolution: Done
Fixed with ISPN-9614
Flag.SKIP_LISTENER_NOTIFICATION does not work for
CacheEntryModifiedEvent and CacheEntryCreatedEvent
----------------------------------------------------------------------------------------------------
Key: ISPN-4095
URL:
https://issues.redhat.com/browse/ISPN-4095
Project: Infinispan
Issue Type: Bug
Components: Listeners
Affects Versions: 6.0.0.Final, 7.0.0.Alpha1
Reporter: tina tian
Priority: Major
Fix For: 10.0.0.Beta3
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() );
}
}
}