Interface Listeners.ReadWriteListeners<K,V>
- All Superinterfaces:
Listeners.WriteListeners<K,V>
- All Known Subinterfaces:
FunctionalNotifier<K,V>
- All Known Implementing Classes:
FunctionalNotifierImpl
- Enclosing class:
- Listeners
Entry created, modified and removed events can only be fired when these originate on a read-write functional map, since this is the only one that guarantees that the previous value has been read, and hence the differentiation between create, modified and removed can be fully guaranteed.
- Since:
- 8.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRead-write listenerNested classes/interfaces inherited from interface org.infinispan.functional.Listeners.WriteListeners
Listeners.WriteListeners.WriteListener<K,V> -
Method Summary
Modifier and TypeMethodDescriptionAdd a read-write listener, and return anAutoCloseableinstance that can be used to remove the listener registration.Add a create event specific listener by passing in aConsumerto be called back each time a new cache entry is created, passing in aEntryView.ReadEntryViewof that new entry.Add a modify/update event specific listener by passing in aBiConsumerto be called back each time an entry is modified or updated, passing in aEntryView.ReadEntryViewof the previous entry as first parameter, and aEntryView.ReadEntryViewof the new value as second parameter.Add a remove event specific listener by passing in aConsumerto be called back each time an entry is removed, passing in theEntryView.ReadEntryViewof the removed entry.Methods inherited from interface org.infinispan.functional.Listeners.WriteListeners
add, onWrite
-
Method Details
-
onCreate
Add a create event specific listener by passing in aConsumerto be called back each time a new cache entry is created, passing in aEntryView.ReadEntryViewof that new entry.This method is shortcut for users who are only interested in create events. If interested in multiple event types, calling
add(ReadWriteListener)is recommended instead.- Parameters:
f- operation to be called each time a new cache entry is created- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-
onModify
Add a modify/update event specific listener by passing in aBiConsumerto be called back each time an entry is modified or updated, passing in aEntryView.ReadEntryViewof the previous entry as first parameter, and aEntryView.ReadEntryViewof the new value as second parameter.This method is shortcut for users who are only interested in update events. If interested in multiple event types, calling
add(ReadWriteListener)is recommended instead.- Parameters:
f- operation to be called each time a new cache entry is modified or updated, with the first parameter theEntryView.ReadEntryViewof the previous entry value, and the second parameter the newEntryView.ReadEntryView- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-
onRemove
Add a remove event specific listener by passing in aConsumerto be called back each time an entry is removed, passing in theEntryView.ReadEntryViewof the removed entry.This method is shortcut for users who are only interested in remove events. If interested in multiple event types, calling
add(ReadWriteListener)is recommended instead.- Parameters:
f- operation to be called each time a new cache entry is removed, with the old cached entry'sEntryView.ReadEntryViewas parameter.- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-
add
Add a read-write listener, and return anAutoCloseableinstance that can be used to remove the listener registration.- Parameters:
l- the read-write functional map event listener- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-