Class FunctionalNotifierImpl<K,V>
- All Implemented Interfaces:
FunctionalNotifier<K,,V> Listeners.ReadWriteListeners<K,,V> Listeners.WriteListeners<K,V>
- Since:
- 8.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.functional.Listeners.ReadWriteListeners
Listeners.ReadWriteListeners.ReadWriteListener<K,V> Nested classes/interfaces inherited from interface org.infinispan.functional.Listeners.WriteListeners
Listeners.WriteListeners.WriteListener<K,V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a read-write listener, and return anAutoCloseableinstance that can be used to remove the listener registration.Add a write-only listener, and return anAutoCloseableinstance that can be used to remove the listener registration.voidnotifyOnCreate(CacheEntry entry) Notify registeredListeners.ReadWriteListeners.ReadWriteListenerinstances of the created entry.voidnotifyOnModify(CacheEntry<K, V> entry, V previousValue, Metadata previousMetadata) Notify registeredListeners.ReadWriteListeners.ReadWriteListenerinstances of the modified entry passing the previous and new value.voidnotifyOnRemove(EntryView.ReadEntryView<K, V> removed) Notify registeredListeners.ReadWriteListeners.ReadWriteListenerinstances of the removed entry passing in the removed entry.voidnotifyOnWrite(CacheEntry<K, V> entry) voidnotifyOnWriteRemove(K key) Notify registeredListeners.WriteListeners.WriteListenerinstances of the written entry.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.Add a write event listener by passing in aConsumerto be called each time a cache entry is created, modified/updated or removed.
-
Constructor Details
-
FunctionalNotifierImpl
public FunctionalNotifierImpl()
-
-
Method Details
-
add
Description copied from interface:Listeners.WriteListenersAdd a write-only listener, and return anAutoCloseableinstance that can be used to remove the listener registration.- Specified by:
addin interfaceListeners.WriteListeners<K,V> - Parameters:
l- the write-only functional map event listener- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-
add
Description copied from interface:Listeners.ReadWriteListenersAdd a read-write listener, and return anAutoCloseableinstance that can be used to remove the listener registration.- Specified by:
addin interfaceListeners.ReadWriteListeners<K,V> - Parameters:
l- the read-write functional map event listener- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-
onCreate
Description copied from interface:Listeners.ReadWriteListenersAdd 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
Listeners.ReadWriteListeners.add(ReadWriteListener)is recommended instead.- Specified by:
onCreatein interfaceListeners.ReadWriteListeners<K,V> - 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
public AutoCloseable onModify(BiConsumer<EntryView.ReadEntryView<K, V>, EntryView.ReadEntryView<K, V>> f) Description copied from interface:Listeners.ReadWriteListenersAdd 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
Listeners.ReadWriteListeners.add(ReadWriteListener)is recommended instead.- Specified by:
onModifyin interfaceListeners.ReadWriteListeners<K,V> - 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
Description copied from interface:Listeners.ReadWriteListenersAdd 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
Listeners.ReadWriteListeners.add(ReadWriteListener)is recommended instead.- Specified by:
onRemovein interfaceListeners.ReadWriteListeners<K,V> - 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
-
onWrite
Description copied from interface:Listeners.WriteListenersAdd a write event listener by passing in aConsumerto be called each time a cache entry is created, modified/updated or removed.For created or modified/updated events, the
EntryView.ReadEntryViewpassed in will represent the newly stored entry, hence implementations will not be available to differentiate between created events vs modified/updated events.For removed events,
EntryView.ReadEntryViewpassed in will represent an empty entry view, henceEntryView.ReadEntryView.find()will return an emptyOptionalinstance, andEntryView.ReadEntryView.get()will throwNoSuchElementException.- Specified by:
onWritein interfaceListeners.WriteListeners<K,V> - Parameters:
f- operation to be called each time a cache entry is written- Returns:
- an
AutoCloseableinstance that can be used to unregister the listener
-
notifyOnCreate
Description copied from interface:FunctionalNotifierNotify registeredListeners.ReadWriteListeners.ReadWriteListenerinstances of the created entry.- Specified by:
notifyOnCreatein interfaceFunctionalNotifier<K,V>
-
notifyOnModify
Description copied from interface:FunctionalNotifierNotify registeredListeners.ReadWriteListeners.ReadWriteListenerinstances of the modified entry passing the previous and new value.- Specified by:
notifyOnModifyin interfaceFunctionalNotifier<K,V>
-
notifyOnRemove
Description copied from interface:FunctionalNotifierNotify registeredListeners.ReadWriteListeners.ReadWriteListenerinstances of the removed entry passing in the removed entry.- Specified by:
notifyOnRemovein interfaceFunctionalNotifier<K,V>
-
notifyOnWrite
- Specified by:
notifyOnWritein interfaceFunctionalNotifier<K,V>
-
notifyOnWriteRemove
Description copied from interface:FunctionalNotifierNotify registeredListeners.WriteListeners.WriteListenerinstances of the written entry.- Specified by:
notifyOnWriteRemovein interfaceFunctionalNotifier<K,V>
-