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
-
Method Summary
Modifier and TypeMethodDescriptionAdd a read-write listener, and return anAutoCloseable
instance that can be used to remove the listener registration.Add a write-only listener, and return anAutoCloseable
instance that can be used to remove the listener registration.void
notifyOnCreate
(CacheEntry entry) Notify registeredListeners.ReadWriteListeners.ReadWriteListener
instances of the created entry.void
notifyOnModify
(CacheEntry<K, V> entry, V previousValue, Metadata previousMetadata) Notify registeredListeners.ReadWriteListeners.ReadWriteListener
instances of the modified entry passing the previous and new value.void
notifyOnRemove
(EntryView.ReadEntryView<K, V> removed) Notify registeredListeners.ReadWriteListeners.ReadWriteListener
instances of the removed entry passing in the removed entry.void
notifyOnWrite
(CacheEntry<K, V> entry) void
notifyOnWriteRemove
(K key) Notify registeredListeners.WriteListeners.WriteListener
instances of the written entry.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.Add a write event listener by passing in aConsumer
to 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.WriteListeners
Add a write-only listener, and return anAutoCloseable
instance that can be used to remove the listener registration.- Specified by:
add
in interfaceListeners.WriteListeners<K,
V> - Parameters:
l
- the write-only functional map event listener- Returns:
- an
AutoCloseable
instance that can be used to unregister the listener
-
add
Description copied from interface:Listeners.ReadWriteListeners
Add a read-write listener, and return anAutoCloseable
instance that can be used to remove the listener registration.- Specified by:
add
in interfaceListeners.ReadWriteListeners<K,
V> - Parameters:
l
- the read-write functional map event listener- Returns:
- an
AutoCloseable
instance that can be used to unregister the listener
-
onCreate
Description copied from interface:Listeners.ReadWriteListeners
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
Listeners.ReadWriteListeners.add(ReadWriteListener)
is recommended instead.- Specified by:
onCreate
in interfaceListeners.ReadWriteListeners<K,
V> - 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
public AutoCloseable onModify(BiConsumer<EntryView.ReadEntryView<K, V>, EntryView.ReadEntryView<K, V>> f) Description copied from interface:Listeners.ReadWriteListeners
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
Listeners.ReadWriteListeners.add(ReadWriteListener)
is recommended instead.- Specified by:
onModify
in 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.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
Description copied from interface:Listeners.ReadWriteListeners
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
Listeners.ReadWriteListeners.add(ReadWriteListener)
is recommended instead.- Specified by:
onRemove
in interfaceListeners.ReadWriteListeners<K,
V> - 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
-
onWrite
Description copied from interface:Listeners.WriteListeners
Add a write event listener by passing in aConsumer
to be called each time a cache entry is created, modified/updated or removed.For created or modified/updated events, the
EntryView.ReadEntryView
passed 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.ReadEntryView
passed in will represent an empty entry view, henceEntryView.ReadEntryView.find()
will return an emptyOptional
instance, andEntryView.ReadEntryView.get()
will throwNoSuchElementException
.- Specified by:
onWrite
in interfaceListeners.WriteListeners<K,
V> - Parameters:
f
- operation to be called each time a cache entry is written- Returns:
- an
AutoCloseable
instance that can be used to unregister the listener
-
notifyOnCreate
Description copied from interface:FunctionalNotifier
Notify registeredListeners.ReadWriteListeners.ReadWriteListener
instances of the created entry.- Specified by:
notifyOnCreate
in interfaceFunctionalNotifier<K,
V>
-
notifyOnModify
Description copied from interface:FunctionalNotifier
Notify registeredListeners.ReadWriteListeners.ReadWriteListener
instances of the modified entry passing the previous and new value.- Specified by:
notifyOnModify
in interfaceFunctionalNotifier<K,
V>
-
notifyOnRemove
Description copied from interface:FunctionalNotifier
Notify registeredListeners.ReadWriteListeners.ReadWriteListener
instances of the removed entry passing in the removed entry.- Specified by:
notifyOnRemove
in interfaceFunctionalNotifier<K,
V>
-
notifyOnWrite
- Specified by:
notifyOnWrite
in interfaceFunctionalNotifier<K,
V>
-
notifyOnWriteRemove
Description copied from interface:FunctionalNotifier
Notify registeredListeners.WriteListeners.WriteListener
instances of the written entry.- Specified by:
notifyOnWriteRemove
in interfaceFunctionalNotifier<K,
V>
-