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
Modifier and TypeInterfaceDescriptionstatic interface
Read-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 anAutoCloseable
instance that can be used to remove the listener registration.Add a create event specific listener by passing in aConsumer
to be called back each time a new cache entry is created, passing in aEntryView.ReadEntryView
of that new entry.Add a modify/update event specific listener by passing in aBiConsumer
to be called back each time an entry is modified or updated, passing in aEntryView.ReadEntryView
of the previous entry as first parameter, and aEntryView.ReadEntryView
of the new value as second parameter.Add a remove event specific listener by passing in aConsumer
to be called back each time an entry is removed, passing in theEntryView.ReadEntryView
of 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 aConsumer
to be called back each time a new cache entry is created, passing in aEntryView.ReadEntryView
of 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
AutoCloseable
instance that can be used to unregister the listener
-
onModify
Add a modify/update event specific listener by passing in aBiConsumer
to be called back each time an entry is modified or updated, passing in aEntryView.ReadEntryView
of the previous entry as first parameter, and aEntryView.ReadEntryView
of 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.ReadEntryView
of the previous entry value, and the second parameter the newEntryView.ReadEntryView
- Returns:
- an
AutoCloseable
instance that can be used to unregister the listener
-
onRemove
Add a remove event specific listener by passing in aConsumer
to be called back each time an entry is removed, passing in theEntryView.ReadEntryView
of 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.ReadEntryView
as parameter.- Returns:
- an
AutoCloseable
instance that can be used to unregister the listener
-
add
Add a read-write listener, and return anAutoCloseable
instance that can be used to remove the listener registration.- Parameters:
l
- the read-write functional map event listener- Returns:
- an
AutoCloseable
instance that can be used to unregister the listener
-